knife-vcloud 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,16 @@
1
1
  Changes
2
+ ==
3
+ 2012-12-24 (0.2.0)
4
+ --
5
+
6
+ FEATURES:
7
+ * Add command for basic VM Guest Customization configuration
8
+ * Add command for basic VM Network configuration
9
+ * Add command for basic vApp Network configuration
10
+
11
+ FIXES:
12
+ * Renamed _Common#msg_ to _Common#out\_msg_
13
+
2
14
  ==
3
15
  2012-12-21 (0.1.0)
4
16
  --
data/README.md CHANGED
@@ -25,7 +25,11 @@ FEATURES
25
25
  - show VDCs
26
26
  - show Catalogs
27
27
  - show Catalog Items
28
- - create/start/stop/delete vApps
28
+ - create/start/stop/delete/show vApps
29
+ - show VMs
30
+ - basic vApp network configuration
31
+ - basic VM network configuration
32
+ - basic VM Guest Customization configuration
29
33
 
30
34
  PREREQUISITES
31
35
  --
@@ -38,16 +42,21 @@ USAGE
38
42
 
39
43
  ###Available commands
40
44
 
41
- knife vc catalog item show [ITEM_ID] (options)
45
+ knife vc catalog item show [CATALOG_ID] (options)
42
46
  knife vc catalog show [CATALOG_ID] (options)
43
47
  knife vc login (options)
44
48
  knife vc org list (options)
45
49
  knife vc org show [ORG_ID] (options)
50
+ knife vc vapp config network [VAPP_ID] [NETWORK_NAME] (options)
46
51
  knife vc vapp create [VDC_ID] [NAME] [DESCRIPTION] [TEMPLATE_ID] (options)
47
52
  knife vc vapp delete [VAPP_ID] (options)
53
+ knife vc vapp show [VAPP_ID] (options)
48
54
  knife vc vapp start [VAPP_ID] (options)
49
55
  knife vc vapp stop [VAPP_ID] (options)
50
56
  knife vc vdc show [VDC_ID] (options)
57
+ knife vc vm config guest [VAPP_ID] [COMPUTER_NAME] (options)
58
+ knife vc vm config network [VAPP_ID] [NETWORK_NAME] (options)
59
+ knife vc vm show [VM_ID] (options)
51
60
 
52
61
  ###Configuration
53
62
  All commands accept the following options:
@@ -193,6 +202,30 @@ _Example:_
193
202
  Name Status IPs ID
194
203
  CENTOS63 running 10.102.46.237 8b943bf9-a8ca-4d41-b97f-316c3aa891ea
195
204
 
205
+ ###vApp's network configuration
206
+ This command allows for basic vApp network configuration.
207
+
208
+ _Example:_
209
+ *TBD*
210
+
211
+ ###Show VM's details
212
+ This command shows details about a given VM.
213
+
214
+ _Example:_
215
+ *TBD*
216
+
217
+ ###VM's network configuration
218
+ This command allows for basic VM network configuration.
219
+
220
+ _Example:_
221
+ *TBD*
222
+
223
+ ###VM's Guest Customization configuration
224
+ This command allows for basic VM Guest Customization configuration.
225
+
226
+ _Example:_
227
+ *TBD*
228
+
196
229
  LICENSE
197
230
  --
198
231
 
@@ -32,7 +32,7 @@ module KnifeVCloud
32
32
  @connection
33
33
  end
34
34
 
35
- def msg(label, value)
35
+ def out_msg(label, value)
36
36
  if value && !value.empty?
37
37
  puts "#{ui.color(label, :cyan)}: #{value}"
38
38
  end
@@ -46,7 +46,7 @@ module KnifeVCloud
46
46
  def wait_task(connection, task_id)
47
47
  status, errormsg, start_time, end_time = connection.wait_task_completion task_id
48
48
  puts "Done!"
49
- msg("Summary", "Status: #{ui.color(status, :cyan)} - started at #{start_time} and ended at #{end_time}")
49
+ out_msg("Summary", "Status: #{ui.color(status, :cyan)} - started at #{start_time} and ended at #{end_time}")
50
50
 
51
51
  if errormsg
52
52
  puts ui.color("ATTENTION: #{errormsg}", :red)
@@ -63,7 +63,7 @@ module KnifeVCloud
63
63
  $stdout.sync = true
64
64
 
65
65
  connection.login
66
- msg("Authenticated successfully, code", connection.auth_key)
66
+ out_msg("Authenticated successfully, code", connection.auth_key)
67
67
 
68
68
  connection.logout
69
69
  end
@@ -59,6 +59,18 @@ module KnifeVCloud
59
59
  :description => "vCloud API version (1.5 and 5.1 supported)",
60
60
  :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
61
 
62
+ option :fence_mode,
63
+ :short => "-F FENCE_MODE",
64
+ :long => "--fence-mode FENCE_MODE",
65
+ :description => "Set Fence Mode (e.g., Isolated, Bridged)",
66
+ :proc => Proc.new { |key| Chef::Config[:knife][:fence_mode] = key }
67
+
68
+ option :retain_network,
69
+ :short => "-R RETAIN_NETWORK",
70
+ :long => "--retain-network RETAIN_NETWORK",
71
+ :description => "Toggle Retain Network across deployments (e.g., true, false)",
72
+ :proc => Proc.new { |key| Chef::Config[:knife][:retain_network] = key }
73
+
62
74
  def run
63
75
  $stdout.sync = true
64
76
 
@@ -67,9 +79,12 @@ module KnifeVCloud
67
79
 
68
80
  connection.login
69
81
 
70
- task_id, response = connection.set_vapp_network_config vapp_id, network_name
82
+ config = {
83
+ :fence_mode => locate_config_value(:fence_mode),
84
+ :retain_net => locate_config_value(:retain_net)
85
+ }
71
86
 
72
- puts response
87
+ task_id, response = connection.set_vapp_network_config vapp_id, network_name, config
73
88
 
74
89
  print "vApp network configuration..."
75
90
  wait_task(connection, task_id)
@@ -75,10 +75,10 @@ module KnifeVCloud
75
75
  name, description, status, ip, vms_hash = connection.show_vapp vapp_id
76
76
  connection.logout
77
77
 
78
- msg("Name", name)
79
- msg("Description", description)
80
- msg("Status", status)
81
- msg("IP", ip)
78
+ out_msg("Name", name)
79
+ out_msg("Description", description)
80
+ out_msg("Status", status)
81
+ out_msg("IP", ip)
82
82
 
83
83
  vms_hash.each do |k, v|
84
84
  list << (k || '')
@@ -59,6 +59,19 @@ module KnifeVCloud
59
59
  :description => "vCloud API version (1.5 and 5.1 supported)",
60
60
  :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
61
 
62
+ option :guest_enabled,
63
+ :short => "-E ENABLED",
64
+ :long => "--enable-guest true|false",
65
+ :description => "Toggle Guest Customization"
66
+
67
+ option :admin_passwd_enabled,
68
+ :long => "--admin-passwd-enabled true|false",
69
+ :description => "Toggle Admin Password"
70
+
71
+ option :admin_passwd,
72
+ :long => "--admin-passwd ADMIN_PASSWD",
73
+ :description => "Set Admin Password"
74
+
62
75
  def run
63
76
  $stdout.sync = true
64
77
 
@@ -67,9 +80,13 @@ module KnifeVCloud
67
80
 
68
81
  connection.login
69
82
 
70
- task_id, response = connection.set_vm_guest_customization vm_id, computer_name, {:enabled => true}
83
+ config = {
84
+ :enabled => locate_config_value(:guest_enabled),
85
+ :admin_passwd_enabled => locate_config_value(:admin_passwd_enabled),
86
+ :admin_passwd => locate_config_value(:admin_passwd)
87
+ }
71
88
 
72
- puts response
89
+ task_id, response = connection.set_vm_guest_customization vm_id, computer_name, config
73
90
 
74
91
  print "VM network configuration..."
75
92
  wait_task(connection, task_id)
@@ -59,6 +59,26 @@ module KnifeVCloud
59
59
  :description => "vCloud API version (1.5 and 5.1 supported)",
60
60
  :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
61
 
62
+ option :vm_net_primary_index,
63
+ :long => "--net-primary NETWORK_PRIMARY_IDX",
64
+ :description => "Index of the primary network interface"
65
+
66
+ option :vm_net_index,
67
+ :long => "--net-index NETWORK_IDX",
68
+ :description => "Index of the current network interface"
69
+
70
+ option :vm_net_ip,
71
+ :long => "--net-ip NETWORK_IP",
72
+ :description => "IP of the current network interface"
73
+
74
+ option :vm_net_is_connected,
75
+ :long => "--net-is-connected true|false",
76
+ :description => "Toggle IsConnected flag of the current network interface"
77
+
78
+ option :vm_ip_allocation_mode,
79
+ :long => "--ip-allocation-mode ALLOCATION_MODE",
80
+ :description => "Set IP allocation mode of the current network interface (e.g., POOL)"
81
+
62
82
  def run
63
83
  $stdout.sync = true
64
84
 
@@ -69,8 +89,6 @@ module KnifeVCloud
69
89
 
70
90
  task_id, response = connection.set_vm_network_config vm_id, network_name, {:ip_allocation_mode => 'POOL'}
71
91
 
72
- puts response
73
-
74
92
  print "VM network configuration..."
75
93
  wait_task(connection, task_id)
76
94
 
@@ -74,7 +74,7 @@ module KnifeVCloud
74
74
  os_desc, networks, guest_customizations = connection.show_vm vm_id
75
75
  connection.logout
76
76
 
77
- msg("OS Name", os_desc)
77
+ out_msg("OS Name", os_desc)
78
78
 
79
79
  networks.each do |network, values|
80
80
  list << ui.color('Network', :bold)
@@ -85,8 +85,8 @@ module KnifeVCloud
85
85
  end
86
86
  end
87
87
 
88
- list << ui.color('Customizations', :bold)
89
- list << ''
88
+ list << ['', '', ui.color('Guest Customizations', :bold), '']
89
+ list.flatten!
90
90
  guest_customizations.each do |k, v|
91
91
  list << (pretty_symbol(k) || '')
92
92
  list << (v || '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef