knife-vcloud 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e1a6581ab79e682545433b7cd7bfa2517c1be97
4
- data.tar.gz: dddf81518b3eeb63a7d65e4493d522c57c34a998
3
+ metadata.gz: 15f25cf5b3ff33de3c9781a8bf54ba462830e2fd
4
+ data.tar.gz: bfe80065421e3114b11639dbc8e693f526646628
5
5
  SHA512:
6
- metadata.gz: 232a90edc098da6619adbba3d7f67d6db238ad46bce3243f7c3b2aa7eeed0f7e8cc81d846ea0978d32fdf5161414d10c8d096a16c7d2b8ba63dfcabfef258311
7
- data.tar.gz: bdff29d51a5dee502ab2c1ebc6db8e15a0f34c464a1b5a903cf93ba0d61d922864591e4bc18a4c578593db61349daf861c095dc78959dba3c8e41226c14c67d1
6
+ metadata.gz: bd8e9aaa2c3771d518dcc6e2e4b9988d4adf9e58885b4d4576bd9b40a150ee21a6f220f525f795de7aa9bb2c10b73a1ae5ebd0ffd2d7a255e0a97e0aa0f03b29
7
+ data.tar.gz: 0897800fc0a73dc7ced36609748d3ee76c2d235119dc97e7388c545db48104f63459352510239e7e41a4ed390d2fbc68c5c7d0270a0ad9278866b9e634e6371b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  Changes
2
2
  ==
3
+ 2014-02-06 (1.2.0)
4
+ --
5
+
6
+ This version requires vcloud-rest v. 1.2.0.
7
+
8
+ FEATURES:
9
+
10
+ * Honor local .chef/knife.rb precedence
11
+
12
+ DEPRECATIONS:
13
+
14
+ * Remove `vm config network` deprecated in 1.1.0
15
+ * Remove *knife[:vcloud_password_login]* deprecated in 1.1.0
16
+
3
17
  2013-12-13 (1.1.0)
4
18
  --
5
19
 
data/README.md CHANGED
@@ -33,7 +33,7 @@ PREREQUISITES
33
33
  --
34
34
  - chef >= 0.10.0
35
35
  - knife-windows
36
- - vcloud-rest ~> 1.0.0
36
+ - vcloud-rest ~> 1.2.0
37
37
 
38
38
  USAGE
39
39
  --
@@ -64,7 +64,6 @@ USAGE
64
64
  knife vc vdc show VDC (options)
65
65
  knife vc vm bootstrap [VM] (options)
66
66
  knife vc vm config guest [VM] (options)
67
- [DEPRECATED] knife vc vm config network [VM] [NETWORK_NAME] (options)
68
67
  knife vc vm network [add|delete|edit| [VM] [NETWORK] (options)
69
68
  knife vc vm reboot [VM] (options)
70
69
  knife vc vm reset [VM] (options)
@@ -80,8 +79,6 @@ USAGE
80
79
  A first configuration should be done using ```knife vc configure``` that would prompt user for
81
80
  credentials and vCloud URL.
82
81
 
83
- **DEPRECATION NOTE: *vcloud_password_login* has been deprecated and will be removed in future versions.**
84
-
85
82
  E.g.,
86
83
 
87
84
  $ bundle exec knife vc configure
@@ -444,8 +441,6 @@ This commands allows for basic VM network configuration and accepts several opti
444
441
 
445
442
  Please note that you must use the human readable name of the network (i.e., _TestNet\_1_).
446
443
 
447
- **DEPRECATION NOTE: The command *vm config network* has been deprecated and will be removed in future versions.**
448
-
449
444
  _Add example:_
450
445
 
451
446
  $ knife vc vm network edit testvm TST_Data
@@ -46,12 +46,6 @@ class Chef
46
46
  :description => "Your vCloud User",
47
47
  :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user_login] = key }
48
48
 
49
- option :vcloud_password_login,
50
- :short => "-P SECRET",
51
- :long => "--password-login SECRET",
52
- :description => "Your vCloud secret key",
53
- :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password_login] = key }
54
-
55
49
  option :vcloud_org_login,
56
50
  :long => "--org-login ORGANIZATION",
57
51
  :description => "Your vCloud Organization",
@@ -81,22 +75,16 @@ class Chef
81
75
  unless @connection
82
76
  pemfile = locate_config_value(:vcloud_pem)
83
77
 
84
- if locate_config_value(:vcloud_password_login)
85
- ui.info("#{ui.color('DEPRECATION WARNING:', :bold)} knife[:vcloud_password_login] is deprecated" \
86
- " and will be removed in the next version. You should remove it and run 'knife vc configure'.")
87
- passwd = locate_config_value(:vcloud_password_login)
88
- else
89
- unless pemfile
90
- raise ConfigurationError, "PEM file not configured. Please run 'knife vc configure'"
91
- end
92
-
93
- unless locate_config_value(:vcloud_password)
94
- raise ConfigurationError, "Password not configured. Please run 'knife vc configure'"
95
- end
78
+ unless pemfile
79
+ raise ConfigurationError, "PEM file not configured. Please run 'knife vc configure'"
80
+ end
96
81
 
97
- passwd = get_password(pemfile)
82
+ unless locate_config_value(:vcloud_password)
83
+ raise ConfigurationError, "Password not configured. Please run 'knife vc configure'"
98
84
  end
99
85
 
86
+ passwd = get_password(pemfile)
87
+
100
88
  @connection = VCloudClient::Connection.new(
101
89
  locate_config_value(:vcloud_url),
102
90
  locate_config_value(:vcloud_user_login),
@@ -177,7 +165,8 @@ class Chef
177
165
  end
178
166
 
179
167
  # Generate a new key pair and store it on knife.rb
180
- def generate_key(dir="#{File.join(Dir.home, '.chef')}", output="vc_key.pem")
168
+ def generate_key(output="vc_key.pem")
169
+ dir = File.dirname(get_config_file)
181
170
  key = OpenSSL::PKey::RSA.new 2048
182
171
 
183
172
  pemfile = File.join(dir, output)
@@ -206,7 +195,7 @@ class Chef
206
195
  #
207
196
  # It checks whether a given configuration already exists and, if so, updates it
208
197
  def store_config(key, value)
209
- configfile = File.join(Dir.home, '.chef', 'knife.rb')
198
+ configfile = get_config_file
210
199
  old_config = File.open(configfile, 'r').readlines
211
200
  full_key = "knife[:#{key}]"
212
201
 
@@ -234,6 +223,16 @@ class Chef
234
223
  end
235
224
 
236
225
  private
226
+ def get_config_file
227
+ knife_cfg = File.join('.chef', 'knife.rb')
228
+
229
+ if File.exists?(File.join(Dir.pwd, knife_cfg))
230
+ File.join(Dir.pwd, knife_cfg)
231
+ else
232
+ File.join(Dir.home, knife_cfg)
233
+ end
234
+ end
235
+
237
236
  def humanize_elapsed_time(start_time, end_time)
238
237
  start_time = Time.parse(start_time || Time.now)
239
238
  end_time = Time.parse(end_time || Time.now)
@@ -55,7 +55,6 @@ require 'chef/knife/vapp/vc_vapp_snapshot'
55
55
  # VM
56
56
  require 'chef/knife/common/vc_vm_common'
57
57
  require 'chef/knife/vm/vc_vm_config_guest'
58
- require 'chef/knife/vm/vc_vm_config_network'
59
58
  require 'chef/knife/vm/vc_vm_network'
60
59
  require 'chef/knife/vm/vc_vm_show'
61
60
  require 'chef/knife/vm/vc_vm_set_info'
@@ -1,3 +1,3 @@
1
1
  module KnifeVCloud
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Tortarolo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.0
47
+ version: 1.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: winrm
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,6 @@ files:
108
108
  - lib/chef/knife/vdc/vc_vdc_show.rb
109
109
  - lib/chef/knife/vm/vc_vm_bootstrap.rb
110
110
  - lib/chef/knife/vm/vc_vm_config_guest.rb
111
- - lib/chef/knife/vm/vc_vm_config_network.rb
112
111
  - lib/chef/knife/vm/vc_vm_network.rb
113
112
  - lib/chef/knife/vm/vc_vm_reboot.rb
114
113
  - lib/chef/knife/vm/vc_vm_reset.rb
@@ -1,84 +0,0 @@
1
- #
2
- # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
- # Copyright:: Copyright (c) 2012-2013
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- class Chef
20
- class Knife
21
- class VcVmConfigNetwork < Chef::Knife
22
- include Knife::VcCommon
23
- include Knife::VcVmCommon
24
-
25
- banner "knife vc vm config network [VM] [NETWORK_NAME] (options)"
26
-
27
- option :vm_net_primary_index,
28
- :long => "--net-primary NETWORK_PRIMARY_IDX",
29
- :description => "Index of the primary network interface"
30
-
31
- option :vm_net_index,
32
- :long => "--net-index NETWORK_IDX",
33
- :description => "Index of the current network interface"
34
-
35
- option :vm_net_ip,
36
- :long => "--net-ip NETWORK_IP",
37
- :description => "IP of the current network interface"
38
-
39
- option :vm_net_is_connected,
40
- :long => "--net-[no-]connected",
41
- :description => "Toggle IsConnected flag of the current network interface (default true)",
42
- :boolean => true,
43
- :default => true
44
-
45
- option :vm_ip_allocation_mode,
46
- :long => "--ip-allocation-mode ALLOCATION_MODE",
47
- :description => "Set IP allocation mode of the current network interface (default POOL)",
48
- :default => 'POOL'
49
-
50
- def run
51
- $stdout.sync = true
52
-
53
- vm_arg = @name_args.shift
54
- network_name = @name_args.shift
55
- config = {
56
- :primary_index => locate_config_value(:vm_net_primary_index),
57
- :network_index => locate_config_value(:vm_net_index),
58
- :ip => locate_config_value(:vm_net_ip),
59
- :is_connected => locate_config_value(:vm_net_is_connected),
60
- :ip_allocation_mode => locate_config_value(:vm_ip_allocation_mode),
61
- }
62
-
63
- connection.login
64
-
65
- deprecation_msg("vm network [add|delete|edit]")
66
-
67
- vm = get_vm(vm_arg)
68
-
69
- stop_if_running(connection, vm)
70
-
71
- ui.msg "VM network configuration..."
72
- task_id = connection.set_vm_network_config vm[:id], network_name, config
73
-
74
- if wait_task(connection, task_id)
75
- ui.msg "Forcing Guest Customization to apply changes..."
76
- task_id = connection.force_customization_vm vm[:id]
77
- wait_task(connection, task_id)
78
- end
79
-
80
- connection.logout
81
- end
82
- end
83
- end
84
- end