Method: Provision#set_local_boot_policy

Defined in:
lib/ucslib/service/ucs/provision.rb

#set_local_boot_policy(json) ⇒ Object



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/ucslib/service/ucs/provision.rb', line 355

def set_local_boot_policy(json)

name             = JSON.parse(json)['name']
description      = JSON.parse(json)['description']
org              = JSON.parse(json)['org']

xml_builder = Nokogiri::XML::Builder.new do |xml|
xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'true'){
  xml.inConfigs{
    xml.pair('key' => "org-root/org-#{org}/boot-policy-#{name}"){
      xml.lsbootPolicy('descr' => "#{description}", 'dn' => "org-root/org-#{org}/boot-policy-#{name}",
                       'enforceVnicName' => 'no', 'name' => "#{name}", 'rebootOnUpdate' => 'no',
                       'status' => 'created'){
                         xml.lsbootVirtualMedia('access' => 'read-only', 'order' => '1', 'rn' => 'read-only-vm', 'status' => 'created')
                         xml.lsbootStorage('order' => '2', 'rn' => 'storage', 'status' => 'created'){
                           xml.lsbootLocalStorage('rn' => 'local-storage', 'status' => 'created')
                         }
                       }
    }
  }
}
end

#Create xml
set_local_boot_policy_xml = xml_builder.to_xml.to_s

#Post
begin
  rest_post(set_local_boot_policy_xml,@url)
rescue Exception => e
  raise "Error #{e}"
end

end