Method: HPE3PAR_API#add_initiator_chap

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

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



738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/puppet/util/hpe3par_api.rb', line 738

def add_initiator_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('INITIATOR'),
                   '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 initiator chap")

  rescue Hpe3parSdk::HPE3PARException => ex
    Puppet.err(ex.message)
    raise ex
  ensure
    cl.logout
  end
end