knife-vrealize 2.1.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{LICENSE.txt → LICENSE} +0 -0
- data/lib/chef/knife/cloud/vra_service.rb +28 -29
- data/lib/chef/knife/cloud/vra_service_helpers.rb +9 -8
- data/lib/chef/knife/cloud/vra_service_options.rb +17 -16
- data/lib/chef/knife/vra_catalog_list.rb +19 -18
- data/lib/chef/knife/vra_server_create.rb +49 -48
- data/lib/chef/knife/vra_server_delete.rb +10 -9
- data/lib/chef/knife/vra_server_list.rb +16 -15
- data/lib/chef/knife/vra_server_show.rb +11 -10
- data/lib/chef/knife/vro_workflow_execute.rb +28 -27
- data/lib/knife-vrealize/version.rb +3 -2
- metadata +20 -114
- data/.github/ISSUE_TEMPLATE.md +0 -23
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- data/.gitignore +0 -17
- data/.rubocop.yml +0 -18
- data/.travis.yml +0 -23
- data/CHANGELOG.md +0 -111
- data/Gemfile +0 -3
- data/Jenkinsfile +0 -28
- data/README.md +0 -217
- data/Rakefile +0 -21
- data/knife-vrealize.gemspec +0 -33
- data/spec/spec_helper.rb +0 -18
- data/spec/unit/cloud/vra_service_helpers_spec.rb +0 -153
- data/spec/unit/cloud/vra_service_spec.rb +0 -251
- data/spec/unit/vra_catalog_list_spec.rb +0 -44
- data/spec/unit/vra_server_create_spec.rb +0 -171
- data/spec/unit/vra_server_delete_spec.rb +0 -64
- data/spec/unit/vra_server_list_spec.rb +0 -51
- data/spec/unit/vra_server_show_spec.rb +0 -44
- data/spec/unit/vro_workflow_execute_spec.rb +0 -366
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: 2015-2019, 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");
|
@@ -17,12 +18,12 @@
|
|
17
18
|
# limitations under the License.
|
18
19
|
#
|
19
20
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
require "chef/knife"
|
22
|
+
require "chef/knife/cloud/server/delete_options"
|
23
|
+
require "chef/knife/cloud/server/delete_command"
|
24
|
+
require_relative "cloud/vra_service"
|
25
|
+
require_relative "cloud/vra_service_helpers"
|
26
|
+
require_relative "cloud/vra_service_options"
|
26
27
|
|
27
28
|
class Chef
|
28
29
|
class Knife
|
@@ -32,12 +33,12 @@ class Chef
|
|
32
33
|
include VraServiceHelpers
|
33
34
|
include VraServiceOptions
|
34
35
|
|
35
|
-
banner
|
36
|
+
banner "knife vra server delete RESOURCE_ID [RESOURCE_ID] (options)"
|
36
37
|
|
37
38
|
# rubocop:disable Style/GuardClause
|
38
39
|
def validate_params!
|
39
40
|
if @name_args.empty?
|
40
|
-
ui.error(
|
41
|
+
ui.error("You must supply a resource ID of a server to delete.")
|
41
42
|
exit(1) if @name_args.empty?
|
42
43
|
end
|
43
44
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: 2015-2019, 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");
|
@@ -17,12 +18,12 @@
|
|
17
18
|
# limitations under the License.
|
18
19
|
#
|
19
20
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
require "chef/knife"
|
22
|
+
require "chef/knife/cloud/server/list_command"
|
23
|
+
require "chef/knife/cloud/server/list_options"
|
24
|
+
require_relative "cloud/vra_service"
|
25
|
+
require_relative "cloud/vra_service_helpers"
|
26
|
+
require_relative "cloud/vra_service_options"
|
26
27
|
|
27
28
|
class Chef
|
28
29
|
class Knife
|
@@ -31,25 +32,25 @@ class Chef
|
|
31
32
|
include VraServiceHelpers
|
32
33
|
include VraServiceOptions
|
33
34
|
|
34
|
-
banner
|
35
|
+
banner "knife vra server list"
|
35
36
|
|
36
37
|
def before_exec_command
|
37
38
|
@columns_with_info = [
|
38
|
-
{ label:
|
39
|
-
{ label:
|
40
|
-
{ label:
|
41
|
-
{ label:
|
39
|
+
{ label: "Resource ID", key: "id" },
|
40
|
+
{ label: "Name", key: "name" },
|
41
|
+
{ label: "Status", key: "status", value_callback: method(:format_status_value) },
|
42
|
+
{ label: "Catalog Name", key: "catalog_name" },
|
42
43
|
]
|
43
44
|
|
44
|
-
@sort_by_field =
|
45
|
+
@sort_by_field = "name"
|
45
46
|
end
|
46
47
|
|
47
48
|
def format_status_value(status)
|
48
49
|
status = status.downcase
|
49
50
|
status_color = case status
|
50
|
-
when
|
51
|
+
when "active"
|
51
52
|
:green
|
52
|
-
when
|
53
|
+
when "deleted"
|
53
54
|
:red
|
54
55
|
else
|
55
56
|
:yellow
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: 2015-2019, 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");
|
@@ -17,12 +18,12 @@
|
|
17
18
|
# limitations under the License.
|
18
19
|
#
|
19
20
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
require "chef/knife"
|
22
|
+
require "chef/knife/cloud/server/show_options"
|
23
|
+
require "chef/knife/cloud/server/show_command"
|
24
|
+
require_relative "cloud/vra_service"
|
25
|
+
require_relative "cloud/vra_service_helpers"
|
26
|
+
require_relative "cloud/vra_service_options"
|
26
27
|
|
27
28
|
class Chef
|
28
29
|
class Knife
|
@@ -32,16 +33,16 @@ class Chef
|
|
32
33
|
include VraServiceHelpers
|
33
34
|
include VraServiceOptions
|
34
35
|
|
35
|
-
banner
|
36
|
+
banner "knife vra server show RESOURCE_ID (options)"
|
36
37
|
|
37
38
|
def validate_params!
|
38
39
|
if @name_args.empty?
|
39
|
-
ui.error(
|
40
|
+
ui.error("You must supply a Resource ID for a server to display.")
|
40
41
|
exit 1
|
41
42
|
end
|
42
43
|
|
43
44
|
if @name_args.size > 1
|
44
|
-
ui.error(
|
45
|
+
ui.error("You may only supply one Resource ID.")
|
45
46
|
exit 1
|
46
47
|
end
|
47
48
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: 2015-2019, 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");
|
@@ -17,8 +18,8 @@
|
|
17
18
|
# limitations under the License.
|
18
19
|
#
|
19
20
|
|
20
|
-
require
|
21
|
-
require
|
21
|
+
require "chef/knife"
|
22
|
+
require "vcoworkflows"
|
22
23
|
|
23
24
|
class Chef
|
24
25
|
class Knife
|
@@ -29,33 +30,33 @@ class Chef
|
|
29
30
|
|
30
31
|
include Chef::Knife::Cloud::Helpers
|
31
32
|
|
32
|
-
banner
|
33
|
+
banner "knife vro workflow execute WORKFLOW_NAME [KEY=VALUE] [KEY=VALUE] (options)"
|
33
34
|
|
34
35
|
option :vro_base_url,
|
35
|
-
long:
|
36
|
-
description:
|
36
|
+
long: "--vro-base-url API_URL",
|
37
|
+
description: "URL for the vro server"
|
37
38
|
|
38
39
|
option :vro_username,
|
39
|
-
long:
|
40
|
-
description:
|
40
|
+
long: "--vro-username USERNAME",
|
41
|
+
description: "Username to use with the vro API"
|
41
42
|
|
42
43
|
option :vro_password,
|
43
|
-
long:
|
44
|
-
description:
|
44
|
+
long: "--vro-password PASSWORD",
|
45
|
+
description: "Password to use with the vro API"
|
45
46
|
|
46
47
|
option :vro_disable_ssl_verify,
|
47
|
-
long:
|
48
|
-
description:
|
48
|
+
long: "--vro-disable-ssl-verify",
|
49
|
+
description: "Skip any SSL verification for the vro API",
|
49
50
|
boolean: true,
|
50
51
|
default: false
|
51
52
|
|
52
53
|
option :vro_workflow_id,
|
53
|
-
long:
|
54
|
-
description:
|
54
|
+
long: "--vro-workflow-id WORKFLOW_ID",
|
55
|
+
description: "ID of the workflow to execute"
|
55
56
|
|
56
57
|
option :request_timeout,
|
57
|
-
long:
|
58
|
-
description:
|
58
|
+
long: "--request-timeout SECONDS",
|
59
|
+
description: "number of seconds to wait for the workflow to complete",
|
59
60
|
default: 300
|
60
61
|
|
61
62
|
def verify_ssl?
|
@@ -81,7 +82,7 @@ class Chef
|
|
81
82
|
|
82
83
|
def parse_and_validate_params!(args)
|
83
84
|
args.each_with_object({}) do |arg, memo|
|
84
|
-
key, value = arg.split(
|
85
|
+
key, value = arg.split("=")
|
85
86
|
raise "Invalid parameter, must be in KEY=VALUE format: #{arg}" if key.nil? || value.nil?
|
86
87
|
|
87
88
|
memo[key] = value
|
@@ -118,18 +119,18 @@ class Chef
|
|
118
119
|
end
|
119
120
|
|
120
121
|
def missing_config_parameters
|
121
|
-
|
122
|
+
%i{vro_username vro_password vro_base_url}.each_with_object([]) do |param, memo|
|
122
123
|
memo << param if locate_config_value(param).nil?
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
126
127
|
def validate!
|
127
128
|
unless missing_config_parameters.empty?
|
128
|
-
print_error_and_exit(
|
129
|
-
"#{missing_config_parameters.join(
|
129
|
+
print_error_and_exit("The following parameters are missing but required:" \
|
130
|
+
"#{missing_config_parameters.join(", ")}")
|
130
131
|
end
|
131
132
|
|
132
|
-
print_error_and_exit(
|
133
|
+
print_error_and_exit("You must supply a workflow name.") if @name_args.empty?
|
133
134
|
end
|
134
135
|
|
135
136
|
def print_error_and_exit(msg)
|
@@ -138,7 +139,7 @@ class Chef
|
|
138
139
|
end
|
139
140
|
|
140
141
|
def print_results
|
141
|
-
ui.msg(
|
142
|
+
ui.msg("")
|
142
143
|
print_output_parameters
|
143
144
|
print_execution_log
|
144
145
|
end
|
@@ -147,18 +148,18 @@ class Chef
|
|
147
148
|
token = vro_client.token
|
148
149
|
return if token.output_parameters.empty?
|
149
150
|
|
150
|
-
ui.msg(ui.color(
|
151
|
+
ui.msg(ui.color("Output Parameters:", :bold))
|
151
152
|
token.output_parameters.each do |k, v|
|
152
153
|
msg_pair(k, "#{v.value} (#{v.type})") unless v.value.nil? || (v.value.respond_to?(:empty?) && v.value.empty?)
|
153
154
|
end
|
154
|
-
ui.msg(
|
155
|
+
ui.msg("")
|
155
156
|
end
|
156
157
|
|
157
158
|
def print_execution_log
|
158
159
|
log = vro_client.log.to_s
|
159
160
|
return if log.nil? || log.empty?
|
160
161
|
|
161
|
-
ui.msg(ui.color(
|
162
|
+
ui.msg(ui.color("Workflow Execution Log:", :bold))
|
162
163
|
ui.msg(log)
|
163
164
|
end
|
164
165
|
|
@@ -173,13 +174,13 @@ class Chef
|
|
173
174
|
|
174
175
|
set_parameters
|
175
176
|
|
176
|
-
ui.msg(
|
177
|
+
ui.msg("Starting workflow execution...")
|
177
178
|
execution_id = execute_workflow
|
178
179
|
|
179
180
|
ui.msg("Workflow execution #{execution_id} started. Waiting for it to complete...")
|
180
181
|
wait_for_workflow
|
181
182
|
|
182
|
-
ui.msg(
|
183
|
+
ui.msg("Workflow execution complete.")
|
183
184
|
|
184
185
|
print_results
|
185
186
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: 2015-2019, 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,5 +19,5 @@
|
|
18
19
|
#
|
19
20
|
|
20
21
|
module KnifeVrealize
|
21
|
-
VERSION =
|
22
|
+
VERSION = "5.0.2"
|
22
23
|
end
|
metadata
CHANGED
@@ -1,43 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-vrealize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Chef
|
7
|
+
- Chef Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: chef
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '12'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '12'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: knife-cloud
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - "
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: 1.2.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
|
-
- - "
|
27
|
+
- - ">="
|
39
28
|
- !ruby/object:Gem::Version
|
40
29
|
version: 1.2.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: vmware-vra
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,81 +72,14 @@ dependencies:
|
|
80
72
|
- - "~>"
|
81
73
|
- !ruby/object:Gem::Version
|
82
74
|
version: '0.5'
|
83
|
-
|
84
|
-
name: bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.7'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.7'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: github_changelog_generator
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '10.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '10.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.35'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0.35'
|
139
|
-
description: Knife plugin to interact with VMware vRealize.
|
75
|
+
description: Chef Infra Knife plugin to interact with VMware vRealize.
|
140
76
|
email:
|
141
|
-
-
|
77
|
+
- oss@chef.io
|
142
78
|
executables: []
|
143
79
|
extensions: []
|
144
80
|
extra_rdoc_files: []
|
145
81
|
files:
|
146
|
-
-
|
147
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
148
|
-
- ".gitignore"
|
149
|
-
- ".rubocop.yml"
|
150
|
-
- ".travis.yml"
|
151
|
-
- CHANGELOG.md
|
152
|
-
- Gemfile
|
153
|
-
- Jenkinsfile
|
154
|
-
- LICENSE.txt
|
155
|
-
- README.md
|
156
|
-
- Rakefile
|
157
|
-
- knife-vrealize.gemspec
|
82
|
+
- LICENSE
|
158
83
|
- lib/chef/knife/cloud/vra_service.rb
|
159
84
|
- lib/chef/knife/cloud/vra_service_helpers.rb
|
160
85
|
- lib/chef/knife/cloud/vra_service_options.rb
|
@@ -165,18 +90,9 @@ files:
|
|
165
90
|
- lib/chef/knife/vra_server_show.rb
|
166
91
|
- lib/chef/knife/vro_workflow_execute.rb
|
167
92
|
- lib/knife-vrealize/version.rb
|
168
|
-
|
169
|
-
- spec/unit/cloud/vra_service_helpers_spec.rb
|
170
|
-
- spec/unit/cloud/vra_service_spec.rb
|
171
|
-
- spec/unit/vra_catalog_list_spec.rb
|
172
|
-
- spec/unit/vra_server_create_spec.rb
|
173
|
-
- spec/unit/vra_server_delete_spec.rb
|
174
|
-
- spec/unit/vra_server_list_spec.rb
|
175
|
-
- spec/unit/vra_server_show_spec.rb
|
176
|
-
- spec/unit/vro_workflow_execute_spec.rb
|
177
|
-
homepage: https://github.com/chef-partners/knife-vrealize
|
93
|
+
homepage: https://github.com/chef/knife-vrealize
|
178
94
|
licenses:
|
179
|
-
- Apache
|
95
|
+
- Apache-2.0
|
180
96
|
metadata: {}
|
181
97
|
post_install_message:
|
182
98
|
rdoc_options: []
|
@@ -186,25 +102,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
102
|
requirements:
|
187
103
|
- - ">="
|
188
104
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
105
|
+
version: '2.5'
|
190
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
107
|
requirements:
|
192
108
|
- - ">="
|
193
109
|
- !ruby/object:Gem::Version
|
194
110
|
version: '0'
|
195
111
|
requirements: []
|
196
|
-
|
197
|
-
rubygems_version: 2.5.1
|
112
|
+
rubygems_version: 3.0.3
|
198
113
|
signing_key:
|
199
114
|
specification_version: 4
|
200
|
-
summary: Knife plugin to interact with VMware vRealize.
|
201
|
-
test_files:
|
202
|
-
- spec/spec_helper.rb
|
203
|
-
- spec/unit/cloud/vra_service_helpers_spec.rb
|
204
|
-
- spec/unit/cloud/vra_service_spec.rb
|
205
|
-
- spec/unit/vra_catalog_list_spec.rb
|
206
|
-
- spec/unit/vra_server_create_spec.rb
|
207
|
-
- spec/unit/vra_server_delete_spec.rb
|
208
|
-
- spec/unit/vra_server_list_spec.rb
|
209
|
-
- spec/unit/vra_server_show_spec.rb
|
210
|
-
- spec/unit/vro_workflow_execute_spec.rb
|
115
|
+
summary: Chef Infra Knife plugin to interact with VMware vRealize.
|
116
|
+
test_files: []
|