knife-openstack 2.1.0 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/chef/knife/cloud/openstack_server_create_options.rb +64 -51
- data/lib/chef/knife/cloud/openstack_service.rb +33 -17
- data/lib/chef/knife/cloud/openstack_service_options.rb +34 -24
- data/lib/chef/knife/openstack_flavor_list.rb +18 -4
- data/lib/chef/knife/openstack_floating_ip_allocate.rb +22 -9
- data/lib/chef/knife/openstack_floating_ip_associate.rb +24 -11
- data/lib/chef/knife/openstack_floating_ip_disassociate.rb +24 -11
- data/lib/chef/knife/openstack_floating_ip_list.rb +18 -4
- data/lib/chef/knife/openstack_floating_ip_release.rb +16 -4
- data/lib/chef/knife/openstack_group_list.rb +21 -4
- data/lib/chef/knife/openstack_helpers.rb +20 -4
- data/lib/chef/knife/openstack_image_list.rb +22 -8
- data/lib/chef/knife/openstack_network_list.rb +18 -4
- data/lib/chef/knife/openstack_server_create.rb +38 -37
- data/lib/chef/knife/openstack_server_delete.rb +17 -5
- data/lib/chef/knife/openstack_server_list.rb +5 -6
- data/lib/chef/knife/openstack_server_show.rb +4 -5
- data/lib/chef/knife/openstack_volume_list.rb +10 -9
- data/lib/knife-openstack/version.rb +2 -2
- metadata +16 -216
- data/.github/ISSUE_TEMPLATE.md +0 -21
- data/.gitignore +0 -32
- data/.travis.yml +0 -18
- data/CHANGELOG.md +0 -339
- data/CONTRIBUTING.MD +0 -164
- data/Gemfile +0 -5
- data/README.md +0 -179
- data/Rakefile +0 -29
- data/knife-openstack.gemspec +0 -41
- data/spec/functional/flavor_list_func_spec.rb +0 -47
- data/spec/functional/floating_ip_list_func_spec.rb +0 -48
- data/spec/functional/group_list_func_spec.rb +0 -65
- data/spec/functional/image_list_func_spec.rb +0 -53
- data/spec/functional/network_list_func_spec.rb +0 -46
- data/spec/functional/server_create_func_spec.rb +0 -118
- data/spec/functional/server_delete_func_spec.rb +0 -84
- data/spec/functional/server_list_func_spec.rb +0 -98
- data/spec/functional/server_show_func_spec.rb +0 -46
- data/spec/functional/volume_list_func_spec.rb +0 -46
- data/spec/integration/cleanup.rb +0 -89
- data/spec/integration/config/environment.yml.sample +0 -13
- data/spec/integration/openstack_spec.rb +0 -649
- data/spec/spec_context.rb +0 -56
- data/spec/spec_helper.rb +0 -128
- data/spec/unit/openstack_flavor_list_spec.rb +0 -30
- data/spec/unit/openstack_floating_ip_allocate_spec.rb +0 -56
- data/spec/unit/openstack_floating_ip_associate_spec.rb +0 -40
- data/spec/unit/openstack_floating_ip_disassociate_spec.rb +0 -39
- data/spec/unit/openstack_floating_ip_list_spec.rb +0 -27
- data/spec/unit/openstack_floating_ip_release_spec.rb +0 -49
- data/spec/unit/openstack_group_list_spec.rb +0 -44
- data/spec/unit/openstack_image_list_spec.rb +0 -32
- data/spec/unit/openstack_network_list_spec.rb +0 -39
- data/spec/unit/openstack_server_create_spec.rb +0 -449
- data/spec/unit/openstack_server_delete_spec.rb +0 -43
- data/spec/unit/openstack_server_list_spec.rb +0 -32
- data/spec/unit/openstack_server_show_spec.rb +0 -42
- data/spec/unit/openstack_service_spec.rb +0 -128
- data/spec/unit/openstack_volume_list_spec.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a023b1f5b4b0c855a8e5d5c2867a5624a3ab6b469368cc182a44ac8c84357f2c
|
4
|
+
data.tar.gz: 79a5238b5dbbd5e1b08a077de6a07b2b3895a57cb6743987aa47b135893e4179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e2b410b73c11c3601697bd362a8ec7f340268c91793279ea2f86b12eb2b6b4cc0f3a5664754d399f68c0b3a29ff15415940907b124525d5e95739278f69bf4b
|
7
|
+
data.tar.gz: 3ad615b18db0d3a94173773288c90daddb8411a06279cadae771cd5ea8f46b97eeb61a9e4347742802474c2997e836f65fdebaee51bc368444395c8bda968742
|
@@ -1,5 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
1
17
|
|
2
|
-
# frozen_string_literal: true
|
3
18
|
require "chef/knife/cloud/server/create_options"
|
4
19
|
|
5
20
|
class Chef
|
@@ -12,82 +27,80 @@ class Chef
|
|
12
27
|
|
13
28
|
# Openstack Server create params.
|
14
29
|
option :private_network,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
30
|
+
long: "--openstack-private-network",
|
31
|
+
description: "Use the private IP for bootstrapping rather than the public IP",
|
32
|
+
boolean: true,
|
33
|
+
default: false
|
19
34
|
|
20
35
|
option :openstack_floating_ip,
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
36
|
+
short: "-a [IP]",
|
37
|
+
long: "--openstack-floating-ip [IP]",
|
38
|
+
default: "-1",
|
39
|
+
description: "Request to associate a floating IP address to the new OpenStack node. Assumes IPs have been allocated to the project. Specific IP is optional."
|
25
40
|
|
26
41
|
option :openstack_volumes,
|
27
|
-
|
28
|
-
|
29
|
-
|
42
|
+
long: "--openstack-volumes VOLUME1,VOLUME2,VOLUME3",
|
43
|
+
description: "Comma separated list of the UUID(s) of the volume(s) to attach to the server",
|
44
|
+
proc: proc { |volumes| volumes.split(",") }
|
30
45
|
|
31
46
|
option :openstack_scheduler_hints,
|
32
|
-
|
33
|
-
|
34
|
-
proc: proc { |i| Chef::Config[:knife][:openstack_scheduler_hints] = i }
|
47
|
+
long: "--scheduler-hints HINTS",
|
48
|
+
description: "A scheduler group hint to OpenStack"
|
35
49
|
|
36
50
|
option :openstack_security_groups,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
51
|
+
short: "-G X,Y,Z",
|
52
|
+
long: "--openstack-groups X,Y,Z",
|
53
|
+
description: "The security groups for this server",
|
54
|
+
default: ["default"],
|
55
|
+
proc: proc { |groups| groups.split(",") }
|
42
56
|
|
43
57
|
option :openstack_ssh_key_id,
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_ssh_key_id] = key }
|
58
|
+
short: "-S KEY",
|
59
|
+
long: "--openstack-ssh-key-id KEY",
|
60
|
+
description: "The OpenStack SSH keypair id"
|
48
61
|
|
49
62
|
option :user_data,
|
50
|
-
|
51
|
-
|
52
|
-
|
63
|
+
long: "--user-data USER_DATA",
|
64
|
+
description: "The file path containing user data information for this server",
|
65
|
+
proc: proc { |user_data| open(user_data, &:read) }
|
53
66
|
|
54
67
|
option :bootstrap_network,
|
55
|
-
|
56
|
-
|
57
|
-
|
68
|
+
long: "--bootstrap-network NAME",
|
69
|
+
default: "public",
|
70
|
+
description: "Specify network for bootstrapping. Default is 'public'."
|
58
71
|
|
59
72
|
option :network,
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
73
|
+
long: "--no-network",
|
74
|
+
boolean: true,
|
75
|
+
default: true,
|
76
|
+
description: "Use first available network for bootstrapping if 'public' and 'private' are unavailable."
|
64
77
|
|
65
78
|
option :network_ids,
|
66
|
-
|
67
|
-
|
68
|
-
|
79
|
+
long: "--network-ids NETWORK_ID_1,NETWORK_ID_2,NETWORK_ID_3",
|
80
|
+
description: "Comma separated list of the UUID(s) of the network(s) for the server to attach",
|
81
|
+
proc: proc { |networks| networks.split(",") }
|
69
82
|
|
70
83
|
option :availability_zone,
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
proc: proc { |z| Chef::Config[:knife][:availability_zone] = z }
|
84
|
+
short: "-Z ZONE_NAME",
|
85
|
+
long: "--availability-zone ZONE_NAME",
|
86
|
+
description: "The availability zone for this server"
|
75
87
|
|
76
88
|
option :metadata,
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
89
|
+
short: "-M X=1",
|
90
|
+
long: "--metadata X=1",
|
91
|
+
description: "Metadata information for this server (may pass multiple times)",
|
92
|
+
proc: proc { |data, accumulator|
|
93
|
+
accumulator ||= {}
|
94
|
+
accumulator.merge!(data.split("=")[0] => data.split("=")[1])
|
95
|
+
}
|
81
96
|
|
82
97
|
option :secret_file,
|
83
|
-
|
84
|
-
|
85
|
-
proc: proc { |sf| Chef::Config[:knife][:secret_file] = sf }
|
98
|
+
long: "--secret-file SECRET_FILE",
|
99
|
+
description: "A file containing the secret key to use to encrypt data bag item values"
|
86
100
|
|
87
101
|
option :secret,
|
88
|
-
|
89
|
-
|
90
|
-
proc: proc { |s| Chef::Config[:knife][:secret] = s }
|
102
|
+
long: "--secret ",
|
103
|
+
description: "The secret key to use to encrypt data bag item values"
|
91
104
|
end
|
92
105
|
end
|
93
106
|
end
|
@@ -1,30 +1,46 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
#
|
3
2
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
4
3
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
5
|
-
#
|
4
|
+
# Author:: Lance Albertson(<lance@osuosl.org>)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
6
19
|
#
|
7
20
|
|
8
21
|
require "chef/knife/cloud/fog/service"
|
22
|
+
require "fog/openstack"
|
9
23
|
|
10
24
|
class Chef
|
11
25
|
class Knife
|
12
26
|
class Cloud
|
13
27
|
class OpenstackService < FogService
|
14
|
-
def initialize(
|
15
|
-
|
16
|
-
Chef::Log.debug("openstack_auth_url #{Chef::Config[:knife][:openstack_auth_url]}")
|
17
|
-
Chef::Log.debug("openstack_tenant #{Chef::Config[:knife][:openstack_tenant]}")
|
18
|
-
Chef::Log.debug("openstack_endpoint_type #{Chef::Config[:knife][:openstack_endpoint_type] || 'publicURL'}")
|
19
|
-
Chef::Log.debug("openstack_insecure #{Chef::Config[:knife][:openstack_insecure]}")
|
20
|
-
Chef::Log.debug("openstack_region #{Chef::Config[:knife][:openstack_region]}")
|
28
|
+
def initialize(config:, **kwargs)
|
29
|
+
super(config: config, **kwargs)
|
21
30
|
|
22
|
-
|
31
|
+
Chef::Log.debug("openstack_username #{config[:openstack_username]}")
|
32
|
+
Chef::Log.debug("openstack_auth_url #{config[:openstack_auth_url]}")
|
33
|
+
Chef::Log.debug("openstack_tenant #{config[:openstack_tenant]}")
|
34
|
+
Chef::Log.debug("openstack_endpoint_type #{config[:openstack_endpoint_type] || "publicURL"}")
|
35
|
+
Chef::Log.debug("openstack_insecure #{config[:openstack_insecure]}")
|
36
|
+
Chef::Log.debug("openstack_region #{config[:openstack_region]}")
|
37
|
+
|
38
|
+
@auth_params = get_auth_params
|
23
39
|
end
|
24
40
|
|
25
41
|
# add alternate user defined api_endpoint value.
|
26
42
|
def add_api_endpoint
|
27
|
-
@auth_params.merge!(openstack_auth_url:
|
43
|
+
@auth_params.merge!(openstack_auth_url: config[:api_endpoint]) unless config[:api_endpoint].nil?
|
28
44
|
end
|
29
45
|
|
30
46
|
def get_server(search_term)
|
@@ -46,23 +62,23 @@ class Chef
|
|
46
62
|
end
|
47
63
|
|
48
64
|
def get_auth_params
|
49
|
-
load_fog_gem
|
50
65
|
params = {
|
51
66
|
provider: "OpenStack",
|
52
67
|
connection_options: {
|
53
|
-
ssl_verify_peer: !
|
68
|
+
ssl_verify_peer: !config[:openstack_insecure],
|
54
69
|
},
|
55
70
|
}
|
56
71
|
|
57
72
|
(
|
58
|
-
Fog::Compute
|
59
|
-
Fog::Compute
|
73
|
+
Fog::OpenStack::Compute.requirements +
|
74
|
+
Fog::OpenStack::Compute.recognized -
|
60
75
|
[:openstack_api_key]
|
61
76
|
).each do |k|
|
62
77
|
next unless k.to_s.start_with?("openstack")
|
63
|
-
|
78
|
+
|
79
|
+
params[k] = config[k]
|
64
80
|
end
|
65
|
-
params[:openstack_api_key] =
|
81
|
+
params[:openstack_api_key] = config[:openstack_password] || config[:openstack_api_key]
|
66
82
|
|
67
83
|
params
|
68
84
|
end
|
@@ -1,4 +1,20 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
2
18
|
require "chef/knife/cloud/fog/options"
|
3
19
|
class Chef
|
4
20
|
class Knife
|
@@ -9,39 +25,33 @@ class Chef
|
|
9
25
|
include FogOptions
|
10
26
|
# Openstack Connection params.
|
11
27
|
option :openstack_username,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_username] = key }
|
28
|
+
short: "-A USERNAME",
|
29
|
+
long: "--openstack-username KEY",
|
30
|
+
description: "Your OpenStack Username"
|
16
31
|
|
17
32
|
option :openstack_password,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_password] = key }
|
33
|
+
short: "-K SECRET",
|
34
|
+
long: "--openstack-password SECRET",
|
35
|
+
description: "Your OpenStack Password"
|
22
36
|
|
23
37
|
option :openstack_tenant,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_tenant] = key }
|
38
|
+
short: "-T NAME",
|
39
|
+
long: "--openstack-tenant NAME",
|
40
|
+
description: "Your OpenStack Tenant NAME"
|
28
41
|
|
29
42
|
option :openstack_auth_url,
|
30
|
-
|
31
|
-
|
32
|
-
proc: proc { |endpoint| Chef::Config[:knife][:openstack_auth_url] = endpoint }
|
43
|
+
long: "--openstack-api-endpoint ENDPOINT",
|
44
|
+
description: "Your OpenStack API endpoint"
|
33
45
|
|
34
46
|
option :openstack_endpoint_type,
|
35
|
-
|
36
|
-
|
37
|
-
proc: proc { |type| Chef::Config[:knife][:openstack_endpoint_type] = type }
|
47
|
+
long: "--openstack-endpoint-type ENDPOINT_TYPE",
|
48
|
+
description: "OpenStack endpoint type to use (publicURL, internalURL, adminURL)"
|
38
49
|
|
39
50
|
option :openstack_insecure,
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_insecure] = key }
|
51
|
+
long: "--insecure",
|
52
|
+
description: "Ignore SSL certificate on the Auth URL",
|
53
|
+
boolean: true,
|
54
|
+
default: false
|
45
55
|
end
|
46
56
|
end
|
47
57
|
end
|
@@ -1,10 +1,24 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright 2014-2020 Chef Software, Inc.
|
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
|
+
#
|
4
18
|
|
5
19
|
require "chef/knife/cloud/list_resource_command"
|
6
|
-
|
7
|
-
|
20
|
+
require_relative "openstack_helpers"
|
21
|
+
require_relative "cloud/openstack_service_options"
|
8
22
|
|
9
23
|
class Chef
|
10
24
|
class Knife
|
@@ -1,9 +1,23 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
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
|
+
#
|
4
18
|
|
5
|
-
|
6
|
-
|
19
|
+
require_relative "openstack_helpers"
|
20
|
+
require_relative "cloud/openstack_service_options"
|
7
21
|
require "chef/knife/cloud/command"
|
8
22
|
|
9
23
|
class Chef
|
@@ -16,13 +30,12 @@ class Chef
|
|
16
30
|
banner "knife openstack floating_ip allocate (options)"
|
17
31
|
|
18
32
|
option :pool,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
proc: proc { |key| Chef::Config[:knife][:pool] = key }
|
33
|
+
short: "-p POOL",
|
34
|
+
long: "--pool POOL",
|
35
|
+
description: "Floating IP pool to allocate from."
|
23
36
|
|
24
37
|
def execute_command
|
25
|
-
@resource = @service.allocate_address(
|
38
|
+
@resource = @service.allocate_address(config[:pool])
|
26
39
|
end
|
27
40
|
|
28
41
|
def after_exec_command
|
@@ -1,10 +1,24 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
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
|
+
#
|
4
18
|
|
5
|
-
|
6
|
-
|
7
|
-
|
19
|
+
require_relative "openstack_helpers"
|
20
|
+
require_relative "cloud/openstack_service_options"
|
21
|
+
require_relative "cloud/openstack_service"
|
8
22
|
require "chef/knife/cloud/command"
|
9
23
|
|
10
24
|
class Chef
|
@@ -17,10 +31,9 @@ class Chef
|
|
17
31
|
banner "knife openstack floating_ip associate IP (options)"
|
18
32
|
|
19
33
|
option :instance_id,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
required: true
|
34
|
+
long: "--instance-id ID",
|
35
|
+
description: "Instance id to associate it with.",
|
36
|
+
required: true
|
24
37
|
|
25
38
|
def execute_command
|
26
39
|
if @name_args[0]
|
@@ -30,9 +43,9 @@ class Chef
|
|
30
43
|
exit 1
|
31
44
|
end
|
32
45
|
|
33
|
-
response = @service.associate_address(instance_id, floating_ip)
|
46
|
+
response = @service.associate_address(config[:instance_id], floating_ip)
|
34
47
|
if response && response.status == 202
|
35
|
-
ui.info "Floating IP #{floating_ip} associated with Instance #{
|
48
|
+
ui.info "Floating IP #{floating_ip} associated with Instance #{config[:instance_id]}"
|
36
49
|
end
|
37
50
|
end
|
38
51
|
end
|