Sha256: dc794d5ae30296c7c5d8e3d727a1630bfcb776688ed0bf7a123879f18af3fae8

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

#
# Authors: Christopher M Wood (<woodc@us.ibm.com>)
#          John F Hutchinson (<jfhutchi@us.ibm.com>) 
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
# 

require 'chef/knife/hmc_base'

class Chef
  class Knife
    class HmcImageList < Knife

      include Knife::HmcBase

      banner "knife hmc image list --nim_host HOSTNAME --nim_user USER --nim_pass PASSWORD"

      option :nim_host,
             :short => "-n HOST",
             :long => "--nim_host HOST",
             :description => "The fully qualified domain name of the NIM server"

      option :nim_user,
             :short => "-l USER",
             :long => "--nim_user USER",
             :description => "The username for the NIM server"


      option :nim_pass,
             :short => "-m PASSWORD",
             :long => "--nim_pass PASSWORD",
             :description => "The password of the user specified in --nim_user"
                 

      def run
        Chef::Log.debug("Listing images...")

        validate!([:nim_host,:nim_user,:nim_pass])        

        nim = Nim.new(get_config(:nim_host),get_config(:nim_user),{:password => get_config(:nim_pass)})
        nim.connect

        puts "Mksysb Image Names: "
        nim.list_images.each do |image_name|
          puts "#{image_name}"
        end
        
        nim.disconnect
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-hmc-1.0.1 lib/chef/knife/hmc_image_list.rb
knife-hmc-1.0.0 lib/chef/knife/hmc_image_list.rb