knife-openstack 1.3.2 → 2.0.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.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +21 -0
- data/.gitignore +5 -0
- data/.travis.yml +9 -7
- data/CHANGELOG.md +174 -92
- data/Gemfile +15 -3
- data/README.md +96 -68
- data/Rakefile +19 -6
- data/knife-openstack.gemspec +17 -15
- data/lib/chef/knife/cloud/openstack_server_create_options.rb +36 -35
- data/lib/chef/knife/cloud/openstack_service.rb +7 -6
- data/lib/chef/knife/cloud/openstack_service_options.rb +18 -17
- data/lib/chef/knife/openstack_flavor_list.rb +11 -10
- data/lib/chef/knife/openstack_floating_ip_allocate.rb +13 -12
- data/lib/chef/knife/openstack_floating_ip_associate.rb +9 -8
- data/lib/chef/knife/openstack_floating_ip_disassociate.rb +9 -8
- data/lib/chef/knife/openstack_floating_ip_list.rb +10 -9
- data/lib/chef/knife/openstack_floating_ip_release.rb +7 -6
- data/lib/chef/knife/openstack_group_list.rb +13 -12
- data/lib/chef/knife/openstack_helpers.rb +8 -7
- data/lib/chef/knife/openstack_image_list.rb +14 -13
- data/lib/chef/knife/openstack_network_list.rb +10 -9
- data/lib/chef/knife/openstack_server_create.rb +57 -56
- data/lib/chef/knife/openstack_server_delete.rb +7 -6
- data/lib/chef/knife/openstack_server_list.rb +16 -15
- data/lib/chef/knife/openstack_server_show.rb +17 -16
- data/lib/chef/knife/openstack_volume_list.rb +10 -9
- data/lib/knife-openstack/version.rb +3 -2
- data/spec/functional/flavor_list_func_spec.rb +13 -12
- data/spec/functional/floating_ip_list_func_spec.rb +14 -13
- data/spec/functional/group_list_func_spec.rb +29 -28
- data/spec/functional/image_list_func_spec.rb +15 -14
- data/spec/functional/network_list_func_spec.rb +13 -12
- data/spec/functional/server_create_func_spec.rb +29 -28
- data/spec/functional/server_delete_func_spec.rb +18 -17
- data/spec/functional/server_list_func_spec.rb +43 -42
- data/spec/functional/server_show_func_spec.rb +7 -6
- data/spec/functional/volume_list_func_spec.rb +12 -11
- data/spec/integration/cleanup.rb +6 -5
- data/spec/integration/openstack_spec.rb +287 -286
- data/spec/spec_context.rb +10 -9
- data/spec/spec_helper.rb +38 -37
- data/spec/unit/openstack_flavor_list_spec.rb +6 -5
- data/spec/unit/openstack_floating_ip_allocate_spec.rb +14 -13
- data/spec/unit/openstack_floating_ip_associate_spec.rb +11 -10
- data/spec/unit/openstack_floating_ip_disassociate_spec.rb +12 -11
- data/spec/unit/openstack_floating_ip_list_spec.rb +6 -5
- data/spec/unit/openstack_floating_ip_release_spec.rb +13 -12
- data/spec/unit/openstack_group_list_spec.rb +11 -10
- data/spec/unit/openstack_image_list_spec.rb +6 -5
- data/spec/unit/openstack_network_list_spec.rb +8 -7
- data/spec/unit/openstack_server_create_spec.rb +131 -130
- data/spec/unit/openstack_server_delete_spec.rb +8 -7
- data/spec/unit/openstack_server_list_spec.rb +6 -5
- data/spec/unit/openstack_server_show_spec.rb +10 -9
- data/spec/unit/openstack_service_spec.rb +26 -25
- data/spec/unit/openstack_volume_list_spec.rb +6 -5
- metadata +9 -105
data/Rakefile
CHANGED
@@ -1,14 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
2
|
-
# Copyright:: Copyright (c) 2013 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
5
|
+
require "bundler"
|
6
|
+
require "bundler/setup"
|
7
|
+
require "bundler/gem_tasks"
|
8
|
+
require "chefstyle"
|
9
|
+
require "rubocop/rake_task"
|
10
|
+
require "rspec/core/rake_task"
|
11
|
+
require "github_changelog_generator/task"
|
12
|
+
require "knife-openstack/version"
|
9
13
|
|
10
14
|
RuboCop::RakeTask.new
|
11
15
|
|
12
16
|
RSpec::Core::RakeTask.new(:spec)
|
13
17
|
|
14
18
|
task default: [:rubocop, :spec]
|
19
|
+
|
20
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
21
|
+
config.future_release = Knife::OpenStack::VERSION
|
22
|
+
config.max_issues = 0
|
23
|
+
config.add_issues_wo_labels = false
|
24
|
+
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
|
25
|
+
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
|
26
|
+
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion,Tech Cleanup".split(",")
|
27
|
+
end
|
data/knife-openstack.gemspec
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
4
|
+
require "knife-openstack/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
7
|
+
s.name = "knife-openstack"
|
7
8
|
s.version = Knife::OpenStack::VERSION
|
8
|
-
s.version = "#{s.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV[
|
9
|
+
s.version = "#{s.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV["TRAVIS"]
|
9
10
|
s.platform = Gem::Platform::RUBY
|
10
11
|
s.has_rdoc = true
|
11
|
-
s.extra_rdoc_files = [
|
12
|
-
s.authors = [
|
13
|
-
s.email = [
|
14
|
-
s.homepage =
|
15
|
-
s.summary =
|
16
|
-
s.description =
|
12
|
+
s.extra_rdoc_files = ["README.md", "LICENSE"]
|
13
|
+
s.authors = ["JJ Asghar"]
|
14
|
+
s.email = ["jj@chef.io"]
|
15
|
+
s.homepage = "https://github.com/chef/knife-openstack"
|
16
|
+
s.summary = "A Chef knife plugin for OpenStack clouds."
|
17
|
+
s.description = "A Chef knife plugin for OpenStack clouds."
|
18
|
+
s.license = "Apache-2.0"
|
17
19
|
|
18
20
|
s.files = `git ls-files`.split("\n")
|
19
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
|
-
s.require_paths = [
|
23
|
+
s.require_paths = ["lib"]
|
22
24
|
|
23
|
-
s.
|
24
|
-
s.add_dependency 'chef', '>= 11'
|
25
|
-
s.add_dependency 'knife-cloud', '~> 1.2.0'
|
25
|
+
s.required_ruby_version = ">= 2.2.2"
|
26
26
|
|
27
|
-
|
27
|
+
s.add_dependency "fog", "~> 1.23"
|
28
|
+
s.add_dependency "chef", ">= 12"
|
29
|
+
s.add_dependency "knife-cloud", "~> 1.2.0"
|
28
30
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require "chef/knife/cloud/server/create_options"
|
3
4
|
|
4
5
|
class Chef
|
5
6
|
class Knife
|
@@ -11,72 +12,72 @@ class Chef
|
|
11
12
|
|
12
13
|
# Openstack Server create params.
|
13
14
|
option :private_network,
|
14
|
-
long:
|
15
|
-
description:
|
15
|
+
long: "--openstack-private-network",
|
16
|
+
description: "Use the private IP for bootstrapping rather than the public IP",
|
16
17
|
boolean: true,
|
17
18
|
default: false
|
18
19
|
|
19
20
|
option :openstack_floating_ip,
|
20
|
-
short:
|
21
|
-
long:
|
22
|
-
default:
|
23
|
-
description:
|
21
|
+
short: "-a [IP]",
|
22
|
+
long: "--openstack-floating-ip [IP]",
|
23
|
+
default: "-1",
|
24
|
+
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."
|
24
25
|
|
25
26
|
option :openstack_volumes,
|
26
|
-
long:
|
27
|
-
description:
|
28
|
-
proc: proc { |volumes| volumes.split(
|
27
|
+
long: "--openstack-volumes VOLUME1,VOLUME2,VOLUME3",
|
28
|
+
description: "Comma separated list of the UUID(s) of the volume(s) to attach to the server",
|
29
|
+
proc: proc { |volumes| volumes.split(",") }
|
29
30
|
|
30
31
|
option :openstack_scheduler_hints,
|
31
|
-
long:
|
32
|
-
description:
|
32
|
+
long: "--scheduler-hints HINTS",
|
33
|
+
description: "A scheduler group hint to OpenStack",
|
33
34
|
proc: proc { |i| Chef::Config[:knife][:openstack_scheduler_hints] = i }
|
34
35
|
|
35
36
|
option :openstack_security_groups,
|
36
|
-
short:
|
37
|
-
long:
|
38
|
-
description:
|
39
|
-
default: [
|
40
|
-
proc: proc { |groups| groups.split(
|
37
|
+
short: "-G X,Y,Z",
|
38
|
+
long: "--openstack-groups X,Y,Z",
|
39
|
+
description: "The security groups for this server",
|
40
|
+
default: ["default"],
|
41
|
+
proc: proc { |groups| groups.split(",") }
|
41
42
|
|
42
43
|
option :openstack_ssh_key_id,
|
43
|
-
short:
|
44
|
-
long:
|
45
|
-
description:
|
44
|
+
short: "-S KEY",
|
45
|
+
long: "--openstack-ssh-key-id KEY",
|
46
|
+
description: "The OpenStack SSH keypair id",
|
46
47
|
proc: proc { |key| Chef::Config[:knife][:openstack_ssh_key_id] = key }
|
47
48
|
|
48
49
|
option :user_data,
|
49
|
-
long:
|
50
|
-
description:
|
50
|
+
long: "--user-data USER_DATA",
|
51
|
+
description: "The file path containing user data information for this server",
|
51
52
|
proc: proc { |user_data| open(user_data, &:read) }
|
52
53
|
|
53
54
|
option :bootstrap_network,
|
54
|
-
long:
|
55
|
-
default:
|
55
|
+
long: "--bootstrap-network NAME",
|
56
|
+
default: "public",
|
56
57
|
description: "Specify network for bootstrapping. Default is 'public'."
|
57
58
|
|
58
59
|
option :network,
|
59
|
-
long:
|
60
|
+
long: "--no-network",
|
60
61
|
boolean: true,
|
61
62
|
default: true,
|
62
63
|
description: "Use first available network for bootstrapping if 'public' and 'private' are unavailable."
|
63
64
|
|
64
65
|
option :network_ids,
|
65
|
-
long:
|
66
|
-
description:
|
67
|
-
proc: proc { |networks| networks.split(
|
66
|
+
long: "--network-ids NETWORK_ID_1,NETWORK_ID_2,NETWORK_ID_3",
|
67
|
+
description: "Comma separated list of the UUID(s) of the network(s) for the server to attach",
|
68
|
+
proc: proc { |networks| networks.split(",") }
|
68
69
|
|
69
70
|
option :availability_zone,
|
70
|
-
short:
|
71
|
-
long:
|
72
|
-
description:
|
71
|
+
short: "-Z ZONE_NAME",
|
72
|
+
long: "--availability-zone ZONE_NAME",
|
73
|
+
description: "The availability zone for this server",
|
73
74
|
proc: proc { |z| Chef::Config[:knife][:availability_zone] = z }
|
74
75
|
|
75
76
|
option :metadata,
|
76
|
-
short:
|
77
|
-
long:
|
78
|
-
description:
|
79
|
-
proc: proc { |data| Chef::Config[:knife][:metadata] ||= {}; Chef::Config[:knife][:metadata].merge!(data.split(
|
77
|
+
short: "-M X=1",
|
78
|
+
long: "--metadata X=1",
|
79
|
+
description: "Metadata information for this server (may pass multiple times)",
|
80
|
+
proc: proc { |data| Chef::Config[:knife][:metadata] ||= {}; Chef::Config[:knife][:metadata].merge!(data.split("=")[0] => data.split("=")[1]) }
|
80
81
|
end
|
81
82
|
end
|
82
83
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
4
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
4
5
|
# Copyright:: Copyright (c) 2013 Chef Software, Inc.
|
5
6
|
#
|
6
7
|
|
7
|
-
require
|
8
|
+
require "chef/knife/cloud/fog/service"
|
8
9
|
|
9
10
|
class Chef
|
10
11
|
class Knife
|
@@ -35,7 +36,7 @@ class Chef
|
|
35
36
|
if servers.length > 1
|
36
37
|
error_message = "Multiple server matches found for '#{search_term}', use an instance_id to be more specific."
|
37
38
|
ui.fatal(error_message)
|
38
|
-
|
39
|
+
raise CloudExceptions::ValidationError, error_message
|
39
40
|
else
|
40
41
|
servers.first
|
41
42
|
end
|
@@ -47,10 +48,10 @@ class Chef
|
|
47
48
|
def get_auth_params
|
48
49
|
load_fog_gem
|
49
50
|
params = {
|
50
|
-
provider:
|
51
|
+
provider: "OpenStack",
|
51
52
|
connection_options: {
|
52
|
-
ssl_verify_peer: !Chef::Config[:knife][:openstack_insecure]
|
53
|
-
}
|
53
|
+
ssl_verify_peer: !Chef::Config[:knife][:openstack_insecure],
|
54
|
+
},
|
54
55
|
}
|
55
56
|
|
56
57
|
(
|
@@ -58,7 +59,7 @@ class Chef
|
|
58
59
|
Fog::Compute::OpenStack.recognized -
|
59
60
|
[:openstack_api_key]
|
60
61
|
).each do |k|
|
61
|
-
next unless k.to_s.start_with?(
|
62
|
+
next unless k.to_s.start_with?("openstack")
|
62
63
|
params[k] = Chef::Config[:knife][k]
|
63
64
|
end
|
64
65
|
params[:openstack_api_key] = Chef::Config[:knife][:openstack_password] || Chef::Config[:knife][:openstack_api_key]
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "chef/knife/cloud/fog/options"
|
2
3
|
class Chef
|
3
4
|
class Knife
|
4
5
|
class Cloud
|
@@ -8,41 +9,41 @@ class Chef
|
|
8
9
|
include FogOptions
|
9
10
|
# Openstack Connection params.
|
10
11
|
option :openstack_username,
|
11
|
-
short:
|
12
|
-
long:
|
13
|
-
description:
|
12
|
+
short: "-A USERNAME",
|
13
|
+
long: "--openstack-username KEY",
|
14
|
+
description: "Your OpenStack Username",
|
14
15
|
proc: proc { |key| Chef::Config[:knife][:openstack_username] = key }
|
15
16
|
|
16
17
|
option :openstack_password,
|
17
|
-
short:
|
18
|
-
long:
|
19
|
-
description:
|
18
|
+
short: "-K SECRET",
|
19
|
+
long: "--openstack-password SECRET",
|
20
|
+
description: "Your OpenStack Password",
|
20
21
|
proc: proc { |key| Chef::Config[:knife][:openstack_password] = key }
|
21
22
|
|
22
23
|
option :openstack_tenant,
|
23
|
-
short:
|
24
|
-
long:
|
25
|
-
description:
|
24
|
+
short: "-T NAME",
|
25
|
+
long: "--openstack-tenant NAME",
|
26
|
+
description: "Your OpenStack Tenant NAME",
|
26
27
|
proc: proc { |key| Chef::Config[:knife][:openstack_tenant] = key }
|
27
28
|
|
28
29
|
option :openstack_auth_url,
|
29
|
-
long:
|
30
|
-
description:
|
30
|
+
long: "--openstack-api-endpoint ENDPOINT",
|
31
|
+
description: "Your OpenStack API endpoint",
|
31
32
|
proc: proc { |endpoint| Chef::Config[:knife][:openstack_auth_url] = endpoint }
|
32
33
|
|
33
34
|
option :openstack_endpoint_type,
|
34
|
-
long:
|
35
|
-
description:
|
35
|
+
long: "--openstack-endpoint-type ENDPOINT_TYPE",
|
36
|
+
description: "OpenStack endpoint type to use (publicURL, internalURL, adminURL)",
|
36
37
|
proc: proc { |type| Chef::Config[:knife][:openstack_endpoint_type] = type }
|
37
38
|
|
38
39
|
option :openstack_insecure,
|
39
|
-
long:
|
40
|
-
description:
|
40
|
+
long: "--insecure",
|
41
|
+
description: "Ignore SSL certificate on the Auth URL",
|
41
42
|
boolean: true,
|
42
43
|
default: false,
|
43
44
|
proc: proc { |key| Chef::Config[:knife][:openstack_insecure] = key }
|
44
45
|
end
|
45
|
-
|
46
|
+
end
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
2
3
|
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "chef/knife/cloud/list_resource_command"
|
6
|
+
require "chef/knife/openstack_helpers"
|
7
|
+
require "chef/knife/cloud/openstack_service_options"
|
7
8
|
|
8
9
|
class Chef
|
9
10
|
class Knife
|
@@ -12,18 +13,18 @@ class Chef
|
|
12
13
|
include OpenstackHelpers
|
13
14
|
include OpenstackServiceOptions
|
14
15
|
|
15
|
-
banner
|
16
|
+
banner "knife openstack flavor list (options)"
|
16
17
|
|
17
18
|
def before_exec_command
|
18
19
|
# set columns_with_info map
|
19
20
|
@columns_with_info = [
|
20
|
-
{ label:
|
21
|
-
{ label:
|
22
|
-
{ label:
|
23
|
-
{ label:
|
24
|
-
{ label:
|
21
|
+
{ label: "Name", key: "name" },
|
22
|
+
{ label: "ID", key: "id" },
|
23
|
+
{ label: "Virtual CPUs", key: "vcpus" },
|
24
|
+
{ label: "RAM", key: "ram", value_callback: method(:ram_in_mb) },
|
25
|
+
{ label: "Disk", key: "disk", value_callback: method(:disk_in_gb) },
|
25
26
|
]
|
26
|
-
@sort_by_field =
|
27
|
+
@sort_by_field = "name"
|
27
28
|
end
|
28
29
|
|
29
30
|
def query_resource
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
2
3
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "chef/knife/openstack_helpers"
|
6
|
+
require "chef/knife/cloud/openstack_service_options"
|
7
|
+
require "chef/knife/cloud/command"
|
7
8
|
|
8
9
|
class Chef
|
9
10
|
class Knife
|
@@ -12,12 +13,12 @@ class Chef
|
|
12
13
|
include OpenstackHelpers
|
13
14
|
include OpenstackServiceOptions
|
14
15
|
|
15
|
-
banner
|
16
|
+
banner "knife openstack floating_ip allocate (options)"
|
16
17
|
|
17
18
|
option :pool,
|
18
|
-
short:
|
19
|
-
long:
|
20
|
-
description:
|
19
|
+
short: "-p POOL",
|
20
|
+
long: "--pool POOL",
|
21
|
+
description: "Floating IP pool to allocate from.",
|
21
22
|
proc: proc { |key| Chef::Config[:knife][:pool] = key }
|
22
23
|
|
23
24
|
def execute_command
|
@@ -25,11 +26,11 @@ class Chef
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def after_exec_command
|
28
|
-
@columns_with_info = [{ label:
|
29
|
-
{ label:
|
30
|
-
{ label:
|
31
|
-
{ label:
|
32
|
-
{ label:
|
29
|
+
@columns_with_info = [{ label: "ID", value: @resource["floating_ip"]["id"].to_s },
|
30
|
+
{ label: "Instance ID", value: @resource["floating_ip"]["instance_id"].to_s },
|
31
|
+
{ label: "Floating IP", value: @resource["floating_ip"]["ip"].to_s },
|
32
|
+
{ label: "Fixed IP", value: @resource["floating_ip"]["fixed_ip"].to_s },
|
33
|
+
{ label: "Pool", value: @resource["floating_ip"]["pool"].to_s },
|
33
34
|
]
|
34
35
|
@service.server_summary(nil, @columns_with_info)
|
35
36
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
2
3
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
5
|
+
require "chef/knife/openstack_helpers"
|
6
|
+
require "chef/knife/cloud/openstack_service_options"
|
7
|
+
require "chef/knife/cloud/openstack_service"
|
8
|
+
require "chef/knife/cloud/command"
|
8
9
|
|
9
10
|
class Chef
|
10
11
|
class Knife
|
@@ -13,11 +14,11 @@ class Chef
|
|
13
14
|
include OpenstackHelpers
|
14
15
|
include OpenstackServiceOptions
|
15
16
|
|
16
|
-
banner
|
17
|
+
banner "knife openstack floating_ip associate IP (options)"
|
17
18
|
|
18
19
|
option :instance_id,
|
19
|
-
long:
|
20
|
-
description:
|
20
|
+
long: "--instance-id ID",
|
21
|
+
description: "Instance id to associate it with.",
|
21
22
|
proc: proc { |key| Chef::Config[:knife][:instance_id] = key },
|
22
23
|
required: true
|
23
24
|
|
@@ -25,7 +26,7 @@ class Chef
|
|
25
26
|
if @name_args[0]
|
26
27
|
floating_ip = @name_args[0]
|
27
28
|
else
|
28
|
-
ui.error
|
29
|
+
ui.error "Please provide Floating IP to associate with."
|
29
30
|
exit 1
|
30
31
|
end
|
31
32
|
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
2
3
|
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
4
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
5
|
+
require "chef/knife/openstack_helpers"
|
6
|
+
require "chef/knife/cloud/openstack_service_options"
|
7
|
+
require "chef/knife/cloud/openstack_service"
|
8
|
+
require "chef/knife/cloud/command"
|
8
9
|
|
9
10
|
class Chef
|
10
11
|
class Knife
|
@@ -13,11 +14,11 @@ class Chef
|
|
13
14
|
include OpenstackHelpers
|
14
15
|
include OpenstackServiceOptions
|
15
16
|
|
16
|
-
banner
|
17
|
+
banner "knife openstack floating_ip disassociate IP (options)"
|
17
18
|
|
18
19
|
option :instance_id,
|
19
|
-
long:
|
20
|
-
description:
|
20
|
+
long: "--instance-id ID",
|
21
|
+
description: "Instance id to disassociate with.",
|
21
22
|
proc: proc { |key| Chef::Config[:knife][:instance_id] = key },
|
22
23
|
required: true
|
23
24
|
|
@@ -25,7 +26,7 @@ class Chef
|
|
25
26
|
if @name_args[0]
|
26
27
|
floating_ip = @name_args[0]
|
27
28
|
else
|
28
|
-
ui.error
|
29
|
+
ui.error "Please provide Floating IP to disassociate."
|
29
30
|
exit 1
|
30
31
|
end
|
31
32
|
instance_id = locate_config_value(:instance_id)
|