knife-openstack 2.1.7 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/cloud/openstack_server_create_options.rb +10 -12
- data/lib/chef/knife/cloud/openstack_service.rb +19 -16
- data/lib/chef/knife/cloud/openstack_service_options.rb +7 -13
- data/lib/chef/knife/openstack_flavor_list.rb +1 -1
- data/lib/chef/knife/openstack_floating_ip_allocate.rb +3 -4
- data/lib/chef/knife/openstack_floating_ip_associate.rb +3 -4
- data/lib/chef/knife/openstack_floating_ip_disassociate.rb +3 -4
- data/lib/chef/knife/openstack_floating_ip_list.rb +1 -1
- data/lib/chef/knife/openstack_floating_ip_release.rb +1 -1
- data/lib/chef/knife/openstack_helpers.rb +2 -2
- data/lib/chef/knife/openstack_image_list.rb +1 -1
- data/lib/chef/knife/openstack_network_list.rb +1 -1
- data/lib/chef/knife/openstack_server_create.rb +31 -30
- data/lib/chef/knife/openstack_server_delete.rb +1 -1
- data/lib/chef/knife/openstack_server_list.rb +1 -1
- data/lib/chef/knife/openstack_server_show.rb +1 -1
- data/lib/chef/knife/openstack_volume_list.rb +3 -2
- data/lib/knife-openstack/version.rb +1 -1
- metadata +15 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a0a494c472a119c0db28580e1ad74a9d0c960c3807b9f540a3f45f1a0b6232c
|
4
|
+
data.tar.gz: 8f34cfec9f7c1dfc7a3e37ee73d54b2b9b722ed34ce580dffce643de0601deb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db644b4289393460a84eee7f529f0b019eb38c832157e18fff91bc767605b3f8e8f245061d5417f2f7e02d4464f000fbcc4e04dd3eaa9ec1a8ddf7abc54c815b
|
7
|
+
data.tar.gz: 7c63fc2bf298afccbc34d867b35518aec9e831858a9217cdd51d4b0f4c61b065e352ab86fb489ea27ba04274e14d220d387825d02f864488cff4692ec88cc568
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -45,8 +45,7 @@ class Chef
|
|
45
45
|
|
46
46
|
option :openstack_scheduler_hints,
|
47
47
|
long: "--scheduler-hints HINTS",
|
48
|
-
description: "A scheduler group hint to OpenStack"
|
49
|
-
proc: proc { |i| Chef::Config[:knife][:openstack_scheduler_hints] = i }
|
48
|
+
description: "A scheduler group hint to OpenStack"
|
50
49
|
|
51
50
|
option :openstack_security_groups,
|
52
51
|
short: "-G X,Y,Z",
|
@@ -58,8 +57,7 @@ class Chef
|
|
58
57
|
option :openstack_ssh_key_id,
|
59
58
|
short: "-S KEY",
|
60
59
|
long: "--openstack-ssh-key-id KEY",
|
61
|
-
description: "The OpenStack SSH keypair id"
|
62
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_ssh_key_id] = key }
|
60
|
+
description: "The OpenStack SSH keypair id"
|
63
61
|
|
64
62
|
option :user_data,
|
65
63
|
long: "--user-data USER_DATA",
|
@@ -85,24 +83,24 @@ class Chef
|
|
85
83
|
option :availability_zone,
|
86
84
|
short: "-Z ZONE_NAME",
|
87
85
|
long: "--availability-zone ZONE_NAME",
|
88
|
-
description: "The availability zone for this server"
|
89
|
-
proc: proc { |z| Chef::Config[:knife][:availability_zone] = z }
|
86
|
+
description: "The availability zone for this server"
|
90
87
|
|
91
88
|
option :metadata,
|
92
89
|
short: "-M X=1",
|
93
90
|
long: "--metadata X=1",
|
94
91
|
description: "Metadata information for this server (may pass multiple times)",
|
95
|
-
proc: proc { |data|
|
92
|
+
proc: proc { |data, accumulator|
|
93
|
+
accumulator ||= {}
|
94
|
+
accumulator.merge!(data.split("=")[0] => data.split("=")[1])
|
95
|
+
}
|
96
96
|
|
97
97
|
option :secret_file,
|
98
98
|
long: "--secret-file SECRET_FILE",
|
99
|
-
description: "A file containing the secret key to use to encrypt data bag item values"
|
100
|
-
proc: proc { |sf| Chef::Config[:knife][:secret_file] = sf }
|
99
|
+
description: "A file containing the secret key to use to encrypt data bag item values"
|
101
100
|
|
102
101
|
option :secret,
|
103
102
|
long: "--secret ",
|
104
|
-
description: "The secret key to use to encrypt data bag item values"
|
105
|
-
proc: proc { |s| Chef::Config[:knife][:secret] = s }
|
103
|
+
description: "The secret key to use to encrypt data bag item values"
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
3
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
4
|
-
#
|
4
|
+
# Author:: Lance Albertson(<lance@osuosl.org>)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# License:: Apache License, Version 2.0
|
6
7
|
#
|
7
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,25 +19,28 @@
|
|
18
19
|
#
|
19
20
|
|
20
21
|
require "chef/knife/cloud/fog/service"
|
22
|
+
require "fog/openstack"
|
21
23
|
|
22
24
|
class Chef
|
23
25
|
class Knife
|
24
26
|
class Cloud
|
25
27
|
class OpenstackService < FogService
|
26
|
-
def initialize(
|
27
|
-
|
28
|
-
Chef::Log.debug("openstack_auth_url #{Chef::Config[:knife][:openstack_auth_url]}")
|
29
|
-
Chef::Log.debug("openstack_tenant #{Chef::Config[:knife][:openstack_tenant]}")
|
30
|
-
Chef::Log.debug("openstack_endpoint_type #{Chef::Config[:knife][:openstack_endpoint_type] || "publicURL"}")
|
31
|
-
Chef::Log.debug("openstack_insecure #{Chef::Config[:knife][:openstack_insecure]}")
|
32
|
-
Chef::Log.debug("openstack_region #{Chef::Config[:knife][:openstack_region]}")
|
28
|
+
def initialize(config:, **kwargs)
|
29
|
+
super(config: config, **kwargs)
|
33
30
|
|
34
|
-
|
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
|
35
39
|
end
|
36
40
|
|
37
41
|
# add alternate user defined api_endpoint value.
|
38
42
|
def add_api_endpoint
|
39
|
-
@auth_params.merge!(openstack_auth_url:
|
43
|
+
@auth_params.merge!(openstack_auth_url: config[:api_endpoint]) unless config[:api_endpoint].nil?
|
40
44
|
end
|
41
45
|
|
42
46
|
def get_server(search_term)
|
@@ -58,24 +62,23 @@ class Chef
|
|
58
62
|
end
|
59
63
|
|
60
64
|
def get_auth_params
|
61
|
-
load_fog_gem
|
62
65
|
params = {
|
63
66
|
provider: "OpenStack",
|
64
67
|
connection_options: {
|
65
|
-
ssl_verify_peer: !
|
68
|
+
ssl_verify_peer: !config[:openstack_insecure],
|
66
69
|
},
|
67
70
|
}
|
68
71
|
|
69
72
|
(
|
70
|
-
Fog::Compute
|
71
|
-
Fog::Compute
|
73
|
+
Fog::OpenStack::Compute.requirements +
|
74
|
+
Fog::OpenStack::Compute.recognized -
|
72
75
|
[:openstack_api_key]
|
73
76
|
).each do |k|
|
74
77
|
next unless k.to_s.start_with?("openstack")
|
75
78
|
|
76
|
-
params[k] =
|
79
|
+
params[k] = config[k]
|
77
80
|
end
|
78
|
-
params[:openstack_api_key] =
|
81
|
+
params[:openstack_api_key] = config[:openstack_password] || config[:openstack_api_key]
|
79
82
|
|
80
83
|
params
|
81
84
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -27,37 +27,31 @@ class Chef
|
|
27
27
|
option :openstack_username,
|
28
28
|
short: "-A USERNAME",
|
29
29
|
long: "--openstack-username KEY",
|
30
|
-
description: "Your OpenStack Username"
|
31
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_username] = key }
|
30
|
+
description: "Your OpenStack Username"
|
32
31
|
|
33
32
|
option :openstack_password,
|
34
33
|
short: "-K SECRET",
|
35
34
|
long: "--openstack-password SECRET",
|
36
|
-
description: "Your OpenStack Password"
|
37
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_password] = key }
|
35
|
+
description: "Your OpenStack Password"
|
38
36
|
|
39
37
|
option :openstack_tenant,
|
40
38
|
short: "-T NAME",
|
41
39
|
long: "--openstack-tenant NAME",
|
42
|
-
description: "Your OpenStack Tenant NAME"
|
43
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_tenant] = key }
|
40
|
+
description: "Your OpenStack Tenant NAME"
|
44
41
|
|
45
42
|
option :openstack_auth_url,
|
46
43
|
long: "--openstack-api-endpoint ENDPOINT",
|
47
|
-
description: "Your OpenStack API endpoint"
|
48
|
-
proc: proc { |endpoint| Chef::Config[:knife][:openstack_auth_url] = endpoint }
|
44
|
+
description: "Your OpenStack API endpoint"
|
49
45
|
|
50
46
|
option :openstack_endpoint_type,
|
51
47
|
long: "--openstack-endpoint-type ENDPOINT_TYPE",
|
52
|
-
description: "OpenStack endpoint type to use (publicURL, internalURL, adminURL)"
|
53
|
-
proc: proc { |type| Chef::Config[:knife][:openstack_endpoint_type] = type }
|
48
|
+
description: "OpenStack endpoint type to use (publicURL, internalURL, adminURL)"
|
54
49
|
|
55
50
|
option :openstack_insecure,
|
56
51
|
long: "--insecure",
|
57
52
|
description: "Ignore SSL certificate on the Auth URL",
|
58
53
|
boolean: true,
|
59
|
-
default: false
|
60
|
-
proc: proc { |key| Chef::Config[:knife][:openstack_insecure] = key }
|
54
|
+
default: false
|
61
55
|
end
|
62
56
|
end
|
63
57
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2020 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -32,11 +32,10 @@ class Chef
|
|
32
32
|
option :pool,
|
33
33
|
short: "-p POOL",
|
34
34
|
long: "--pool POOL",
|
35
|
-
description: "Floating IP pool to allocate from."
|
36
|
-
proc: proc { |key| Chef::Config[:knife][:pool] = key }
|
35
|
+
description: "Floating IP pool to allocate from."
|
37
36
|
|
38
37
|
def execute_command
|
39
|
-
@resource = @service.allocate_address(
|
38
|
+
@resource = @service.allocate_address(config[:pool])
|
40
39
|
end
|
41
40
|
|
42
41
|
def after_exec_command
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -33,7 +33,6 @@ class Chef
|
|
33
33
|
option :instance_id,
|
34
34
|
long: "--instance-id ID",
|
35
35
|
description: "Instance id to associate it with.",
|
36
|
-
proc: proc { |key| Chef::Config[:knife][:instance_id] = key },
|
37
36
|
required: true
|
38
37
|
|
39
38
|
def execute_command
|
@@ -44,9 +43,9 @@ class Chef
|
|
44
43
|
exit 1
|
45
44
|
end
|
46
45
|
|
47
|
-
response = @service.associate_address(
|
46
|
+
response = @service.associate_address(config[:instance_id], floating_ip)
|
48
47
|
if response && response.status == 202
|
49
|
-
ui.info "Floating IP #{floating_ip} associated with Instance #{
|
48
|
+
ui.info "Floating IP #{floating_ip} associated with Instance #{config[:instance_id]}"
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -33,7 +33,6 @@ class Chef
|
|
33
33
|
option :instance_id,
|
34
34
|
long: "--instance-id ID",
|
35
35
|
description: "Instance id to disassociate with.",
|
36
|
-
proc: proc { |key| Chef::Config[:knife][:instance_id] = key },
|
37
36
|
required: true
|
38
37
|
|
39
38
|
def execute_command
|
@@ -44,9 +43,9 @@ class Chef
|
|
44
43
|
exit 1
|
45
44
|
end
|
46
45
|
|
47
|
-
response = @service.disassociate_address(
|
46
|
+
response = @service.disassociate_address(config[:instance_id], floating_ip)
|
48
47
|
if response && response.status == 202
|
49
|
-
ui.info "Floating IP #{floating_ip} disassociated with Instance #{
|
48
|
+
ui.info "Floating IP #{floating_ip} disassociated with Instance #{config[:instance_id]}"
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2015-
|
3
|
+
# Copyright:: Copyright 2015-2020 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2015-
|
3
|
+
# Copyright:: Copyright 2015-2020 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -34,7 +34,7 @@ class Chef
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def create_service_instance
|
37
|
-
OpenstackService.new
|
37
|
+
OpenstackService.new(config: config)
|
38
38
|
end
|
39
39
|
|
40
40
|
def validate!
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2020 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2020 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
3
|
# Author:: Matt Ray (<matt@chef.io>)
|
4
4
|
# Author:: Chirag Jog (<chirag@clogeny.com>)
|
5
|
-
#
|
5
|
+
# Author:: Lance Albertson (<lance@osuosl.org>)
|
6
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
8
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -42,19 +43,19 @@ class Chef
|
|
42
43
|
server_def: {
|
43
44
|
# servers require a name, knife-cloud generates the chef_node_name
|
44
45
|
:name => config[:chef_node_name],
|
45
|
-
:image_ref => service.get_image(
|
46
|
-
:flavor_ref => service.get_flavor(
|
47
|
-
:security_groups =>
|
48
|
-
:availability_zone =>
|
49
|
-
"os:scheduler_hints" =>
|
50
|
-
:metadata =>
|
51
|
-
:key_name =>
|
46
|
+
:image_ref => service.get_image(config[:image]).id,
|
47
|
+
:flavor_ref => service.get_flavor(config[:flavor]).id,
|
48
|
+
:security_groups => config[:openstack_security_groups],
|
49
|
+
:availability_zone => config[:availability_zone],
|
50
|
+
"os:scheduler_hints" => config[:openstack_scheduler_hints],
|
51
|
+
:metadata => config[:metadata],
|
52
|
+
:key_name => config[:openstack_ssh_key_id],
|
52
53
|
},
|
53
|
-
server_create_timeout:
|
54
|
+
server_create_timeout: config[:server_create_timeout],
|
54
55
|
}
|
55
|
-
unless
|
56
|
+
unless config[:openstack_volumes].nil?
|
56
57
|
counter = 99
|
57
|
-
@create_options[:server_def][:block_device_mapping] =
|
58
|
+
@create_options[:server_def][:block_device_mapping] = config[:openstack_volumes].map do |vol|
|
58
59
|
counter += 1
|
59
60
|
{
|
60
61
|
volume_id: vol,
|
@@ -65,8 +66,8 @@ class Chef
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
@create_options[:server_def][:user_data] =
|
69
|
-
@create_options[:server_def][:nics] =
|
69
|
+
@create_options[:server_def][:user_data] = config[:user_data] if config[:user_data]
|
70
|
+
@create_options[:server_def][:nics] = config[:network_ids].map { |nic| nic_id = { "net_id" => nic } } if config[:network_ids]
|
70
71
|
|
71
72
|
Chef::Log.debug("Create server params - server_def = #{@create_options[:server_def]}")
|
72
73
|
# set columns_with_info map
|
@@ -93,7 +94,7 @@ class Chef
|
|
93
94
|
msg_pair("Public IP Address", primary_public_ip_address(server.addresses)) if primary_public_ip_address(server.addresses)
|
94
95
|
msg_pair("Private IP Address", primary_private_ip_address(server.addresses)) if primary_private_ip_address(server.addresses)
|
95
96
|
|
96
|
-
floating_address =
|
97
|
+
floating_address = config[:openstack_floating_ip]
|
97
98
|
bind_ip = primary_network_ip_address(server.addresses, server.addresses.keys[0])
|
98
99
|
Chef::Log.debug("Floating IP Address requested #{floating_address}")
|
99
100
|
unless floating_address == "-1" # no floating IP requested
|
@@ -139,10 +140,10 @@ class Chef
|
|
139
140
|
super
|
140
141
|
|
141
142
|
# Use SSH password either specified from command line or from openstack server instance
|
142
|
-
config[:ssh_password] =
|
143
|
+
config[:ssh_password] = config[:ssh_password] || server.password unless config[:openstack_ssh_key_id]
|
143
144
|
|
144
|
-
# The bootstrap network is always
|
145
|
-
# only set the bootstrap network to 'private' if still
|
145
|
+
# The bootstrap network is always initialized to 'public' when a network name isn't specified. Therefore,
|
146
|
+
# only set the bootstrap network to 'private' if still initialized to public and nothing was specified for
|
146
147
|
# the private network name.
|
147
148
|
config[:bootstrap_network] = "private" if config[:private_network] && config[:bootstrap_network] == "public"
|
148
149
|
|
@@ -171,33 +172,33 @@ class Chef
|
|
171
172
|
|
172
173
|
def validate_params!
|
173
174
|
# set param vm_name to a random value if the name is not set by the user (plugin)
|
174
|
-
config[:chef_node_name] = get_node_name(
|
175
|
+
config[:chef_node_name] = get_node_name(config[:chef_node_name], config[:chef_node_name_prefix])
|
175
176
|
|
176
177
|
errors = []
|
177
178
|
|
178
|
-
if
|
179
|
-
if
|
180
|
-
errors << "You must provide
|
179
|
+
if config[:connection_protocol] == "winrm"
|
180
|
+
if config[:connection_password].nil?
|
181
|
+
errors << "You must provide Connection Password."
|
181
182
|
end
|
182
|
-
elsif
|
183
|
+
elsif config[:connection_protocol] != "ssh"
|
183
184
|
errors << "You must provide a valid bootstrap protocol. options [ssh/winrm]. For linux type images, options [ssh]"
|
184
185
|
end
|
185
186
|
|
186
|
-
errors << "You must provide --image-os-type option [windows/linux]" unless %w{windows linux}.include?(
|
187
|
+
errors << "You must provide --image-os-type option [windows/linux]" unless %w{windows linux}.include?(config[:image_os_type])
|
187
188
|
error_message = ""
|
188
189
|
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
189
190
|
end
|
190
191
|
|
191
192
|
def is_image_valid?
|
192
|
-
service.get_image(
|
193
|
+
service.get_image(config[:image]).nil? ? false : true
|
193
194
|
end
|
194
195
|
|
195
196
|
def is_flavor_valid?
|
196
|
-
service.get_flavor(
|
197
|
+
service.get_flavor(config[:flavor]).nil? ? false : true
|
197
198
|
end
|
198
199
|
|
199
200
|
def is_floating_ip_valid?
|
200
|
-
address =
|
201
|
+
address = config[:openstack_floating_ip]
|
201
202
|
|
202
203
|
return true if address == "-1" # no floating IP requested
|
203
204
|
|
@@ -207,16 +208,16 @@ class Chef
|
|
207
208
|
# floating requested without value
|
208
209
|
if address.nil?
|
209
210
|
if addresses.find_index { |a| a.fixed_ip.nil? }
|
210
|
-
|
211
|
+
true
|
211
212
|
else
|
212
|
-
|
213
|
+
false # no floating IPs available
|
213
214
|
end
|
214
215
|
else
|
215
216
|
# floating requested with value
|
216
217
|
if addresses.find_index { |a| a.ip == address }
|
217
|
-
|
218
|
+
true
|
218
219
|
else
|
219
|
-
|
220
|
+
false # requested floating IP does not exist
|
220
221
|
end
|
221
222
|
end
|
222
223
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
3
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
4
|
-
# Copyright:: Copyright 2013-
|
4
|
+
# Copyright:: Copyright 2013-2020 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Author:: Matt Ray (<matt@chef.io>)
|
4
4
|
# Author:: Chirag Jog (<chirag@clogeny.com>)
|
5
5
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
6
|
-
# Copyright:: Copyright 2011-
|
6
|
+
# Copyright:: Copyright 2011-2020 Chef Software, Inc.
|
7
7
|
# License:: Apache License, Version 2.0
|
8
8
|
#
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
3
3
|
# Author:: Matt Ray (<matt@chef.io>)
|
4
4
|
# Author:: Evan Felix (<karcaw@gmail.com>)
|
5
|
-
#
|
5
|
+
# Author:: Lance Albertson (<lance@osuosl.org>)
|
6
|
+
# Copyright:: Copyright 2011-2020 Chef Software, Inc.
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
8
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -33,7 +34,7 @@ class Chef
|
|
33
34
|
banner "knife openstack volume list (options)"
|
34
35
|
|
35
36
|
def query_resource
|
36
|
-
@service.connection.volumes
|
37
|
+
@service.connection.volumes.all({})
|
37
38
|
rescue Excon::Errors::BadRequest => e
|
38
39
|
response = Chef::JSONCompat.from_json(e.response.body)
|
39
40
|
ui.fatal("Unknown server error (#{response["badRequest"]["code"]}): #{response["badRequest"]["message"]}")
|
metadata
CHANGED
@@ -1,64 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-openstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JJ Asghar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: fog
|
14
|
+
name: fog-openstack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: knife-cloud
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: knife
|
42
|
+
name: knife
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '3.0'
|
47
|
+
version: '17.0'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - ">="
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
58
|
-
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '3.0'
|
61
|
-
description: A Chef knife plugin for OpenStack clouds.
|
54
|
+
version: '17.0'
|
55
|
+
description: A Chef Infra knife plugin for OpenStack clouds.
|
62
56
|
email:
|
63
57
|
- jj@chef.io
|
64
58
|
executables: []
|
@@ -97,15 +91,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
91
|
requirements:
|
98
92
|
- - ">="
|
99
93
|
- !ruby/object:Gem::Version
|
100
|
-
version: '2.
|
94
|
+
version: '2.7'
|
101
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
96
|
requirements:
|
103
97
|
- - ">="
|
104
98
|
- !ruby/object:Gem::Version
|
105
99
|
version: '0'
|
106
100
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.1.4
|
108
102
|
signing_key:
|
109
103
|
specification_version: 4
|
110
|
-
summary: A Chef knife plugin for OpenStack clouds.
|
104
|
+
summary: A Chef Infra knife plugin for OpenStack clouds.
|
111
105
|
test_files: []
|