Method: HPE3PAR_API#add_target_chap

Defined in:
lib/puppet/util/hpe3par_api.rb

#add_target_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false) ⇒ Object



771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
# File 'lib/puppet/util/hpe3par_api.rb', line 771

def add_target_chap(host_name, chap_name, chap_secret, chap_secret_hex, debug = false)
  cl = Hpe3parSdk::Client.new(@rest_url, debug: debug)
  begin
    cl.(@url.user, @url.password)
    mod_request = {'chapOperationMode' => Hpe3parSdk::ChapOperationMode.const_get('TARGET'),
                   'chapOperation' => Hpe3parSdk::HostEditOperation.const_get('ADD'),
                   'chapName' => chap_name, 'chapSecret' => chap_secret, 'chapSecretHex' => chap_secret_hex}
    cl.modify_host(host_name, mod_request)
    Puppet.info("Host #{host_name} modified to add target chap")
  rescue Hpe3parSdk::HPE3PARException => ex
    Puppet.err(ex.message)
    raise ex
  ensure
    cl.logout
  end
end