Class: HmcUpgrade

Inherits:
Object
  • Object
show all
Defined in:
lib/HMC/Hmc_upgrade.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHmcUpgrade

Returns a new instance of HmcUpgrade.



36
37
38
# File 'lib/HMC/Hmc_upgrade.rb', line 36

def initialize
  #

end

Instance Attribute Details

#_typeObject (readonly)

Returns the value of attribute _type.



27
28
29
# File 'lib/HMC/Hmc_upgrade.rb', line 27

def _type
  @_type
end

#_versionObject

Returns the value of attribute _version.



25
26
27
# File 'lib/HMC/Hmc_upgrade.rb', line 25

def _version
  @_version
end

#filenameObject

Returns the value of attribute filename.



9
10
11
# File 'lib/HMC/Hmc_upgrade.rb', line 9

def filename
  @filename
end

#hostnameObject

Returns the value of attribute hostname.



3
4
5
# File 'lib/HMC/Hmc_upgrade.rb', line 3

def hostname
  @hostname
end

#interactiveObject

Returns the value of attribute interactive.



12
13
14
# File 'lib/HMC/Hmc_upgrade.rb', line 12

def interactive
  @interactive
end

#mount_locationObject

Returns the value of attribute mount_location.



7
8
9
# File 'lib/HMC/Hmc_upgrade.rb', line 7

def mount_location
  @mount_location
end

#mount_optionsObject

Returns the value of attribute mount_options.



8
9
10
# File 'lib/HMC/Hmc_upgrade.rb', line 8

def mount_options
  @mount_options
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/HMC/Hmc_upgrade.rb', line 5

def password
  @password
end

#rebootObject

Returns the value of attribute reboot.



10
11
12
# File 'lib/HMC/Hmc_upgrade.rb', line 10

def reboot
  @reboot
end

#remove_fileObject

Returns the value of attribute remove_file.



11
12
13
# File 'lib/HMC/Hmc_upgrade.rb', line 11

def remove_file
  @remove_file
end

#ssh_keyObject

Returns the value of attribute ssh_key.



6
7
8
# File 'lib/HMC/Hmc_upgrade.rb', line 6

def ssh_key
  @ssh_key
end

#userObject

Returns the value of attribute user.



4
5
6
# File 'lib/HMC/Hmc_upgrade.rb', line 4

def user
  @user
end

Instance Method Details

#cmdObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/HMC/Hmc_upgrade.rb', line 55

def cmd
  validate

  command = 'updhmc '
  command += '-r ' if @reboot == true

  if @_type == 'server'
    command += "-t s -h #{@hostname} -u #{@user} -p #{@password} -f #{@filename}"
  elsif @_type == 'media'
    raise 'type media - not implemented'
  elsif @_type == 'local_filesystem'
    raise 'type local_filesystem - not implemented'
  end
  command
end

#validateObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/HMC/Hmc_upgrade.rb', line 40

def validate

  if @_type.nil?
    @_type = 'server' unless @hostname.nil?
    @_type = 'server' unless @user.nil?
    @_type = 'server' unless @password.nil?
  end

  if @_type == 'server'
    raise 'hostname not setup' if @hostname.nil?
    raise 'user not setup'     if @user.nil?
    raise 'password not setup' if @password.nil?
  end
end