knife-vrealize 3.0.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,27 +18,30 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife'
22
- require 'chef/knife/cloud/server/delete_options'
23
- require 'chef/knife/cloud/server/delete_command'
24
- require 'chef/knife/cloud/vra_service'
25
- require 'chef/knife/cloud/vra_service_helpers'
26
- require 'chef/knife/cloud/vra_service_options'
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_options"
27
25
 
28
26
  class Chef
29
27
  class Knife
30
28
  class Cloud
31
29
  class VraServerDelete < ServerDeleteCommand
32
30
  include ServerDeleteOptions
33
- include VraServiceHelpers
34
31
  include VraServiceOptions
35
32
 
36
- banner 'knife vra server delete RESOURCE_ID [RESOURCE_ID] (options)'
33
+ banner "knife vra server delete RESOURCE_ID [RESOURCE_ID] (options)"
34
+
35
+ deps do
36
+ require_relative "cloud/vra_service"
37
+ require_relative "cloud/vra_service_helpers"
38
+ include VraServiceHelpers
39
+ end
37
40
 
38
41
  # rubocop:disable Style/GuardClause
39
42
  def validate_params!
40
43
  if @name_args.empty?
41
- ui.error('You must supply a resource ID of a server to delete.')
44
+ ui.error("You must supply a resource ID of a server to delete.")
42
45
  exit(1) if @name_args.empty?
43
46
  end
44
47
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,39 +18,42 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife'
22
- require 'chef/knife/cloud/server/list_command'
23
- require 'chef/knife/cloud/server/list_options'
24
- require 'chef/knife/cloud/vra_service'
25
- require 'chef/knife/cloud/vra_service_helpers'
26
- require 'chef/knife/cloud/vra_service_options'
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_options"
27
25
 
28
26
  class Chef
29
27
  class Knife
30
28
  class Cloud
31
29
  class VraServerList < ServerListCommand
32
- include VraServiceHelpers
33
30
  include VraServiceOptions
34
31
 
35
- banner 'knife vra server list'
32
+ banner "knife vra server list"
33
+
34
+ deps do
35
+ require_relative "cloud/vra_service"
36
+ require_relative "cloud/vra_service_helpers"
37
+ include VraServiceHelpers
38
+ end
36
39
 
37
40
  def before_exec_command
38
41
  @columns_with_info = [
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
+ { label: "Resource ID", key: "id" },
43
+ { label: "Name", key: "name" },
44
+ { label: "Status", key: "status", value_callback: method(:format_status_value) },
45
+ { label: "Catalog Name", key: "catalog_name" },
43
46
  ]
44
47
 
45
- @sort_by_field = 'name'
48
+ @sort_by_field = "name"
46
49
  end
47
50
 
48
51
  def format_status_value(status)
49
52
  status = status.downcase
50
53
  status_color = case status
51
- when 'active'
54
+ when "active"
52
55
  :green
53
- when 'deleted'
56
+ when "deleted"
54
57
  :red
55
58
  else
56
59
  :yellow
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,31 +18,34 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife'
22
- require 'chef/knife/cloud/server/show_options'
23
- require 'chef/knife/cloud/server/show_command'
24
- require 'chef/knife/cloud/vra_service'
25
- require 'chef/knife/cloud/vra_service_helpers'
26
- require 'chef/knife/cloud/vra_service_options'
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_options"
27
25
 
28
26
  class Chef
29
27
  class Knife
30
28
  class Cloud
31
29
  class VraServerShow < ServerShowCommand
32
30
  include ServerShowOptions
33
- include VraServiceHelpers
34
31
  include VraServiceOptions
35
32
 
36
- banner 'knife vra server show RESOURCE_ID (options)'
33
+ banner "knife vra server show RESOURCE_ID (options)"
34
+
35
+ deps do
36
+ require_relative "cloud/vra_service"
37
+ require_relative "cloud/vra_service_helpers"
38
+ include VraServiceHelpers
39
+ end
37
40
 
38
41
  def validate_params!
39
42
  if @name_args.empty?
40
- ui.error('You must supply a Resource ID for a server to display.')
43
+ ui.error("You must supply a Resource ID for a server to display.")
41
44
  exit 1
42
45
  end
43
46
 
44
47
  if @name_args.size > 1
45
- ui.error('You may only supply one Resource ID.')
48
+ ui.error("You may only supply one Resource ID.")
46
49
  exit 1
47
50
  end
48
51
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,8 +18,8 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife'
22
- require 'vcoworkflows'
21
+ require "chef/knife"
22
+ require "vcoworkflows"
23
23
 
24
24
  class Chef
25
25
  class Knife
@@ -30,44 +30,44 @@ class Chef
30
30
 
31
31
  include Chef::Knife::Cloud::Helpers
32
32
 
33
- banner 'knife vro workflow execute WORKFLOW_NAME [KEY=VALUE] [KEY=VALUE] (options)'
33
+ banner "knife vro workflow execute WORKFLOW_NAME [KEY=VALUE] [KEY=VALUE] (options)"
34
34
 
35
35
  option :vro_base_url,
36
- long: '--vro-base-url API_URL',
37
- description: 'URL for the vro server'
36
+ long: "--vro-base-url API_URL",
37
+ description: "URL for the vro server"
38
38
 
39
39
  option :vro_username,
40
- long: '--vro-username USERNAME',
41
- description: 'Username to use with the vro API'
40
+ long: "--vro-username USERNAME",
41
+ description: "Username to use with the vro API"
42
42
 
43
43
  option :vro_password,
44
- long: '--vro-password PASSWORD',
45
- description: 'Password to use with the vro API'
44
+ long: "--vro-password PASSWORD",
45
+ description: "Password to use with the vro API"
46
46
 
47
47
  option :vro_disable_ssl_verify,
48
- long: '--vro-disable-ssl-verify',
49
- description: 'Skip any SSL verification for the vro API',
48
+ long: "--vro-disable-ssl-verify",
49
+ description: "Skip any SSL verification for the vro API",
50
50
  boolean: true,
51
51
  default: false
52
52
 
53
53
  option :vro_workflow_id,
54
- long: '--vro-workflow-id WORKFLOW_ID',
55
- description: 'ID of the workflow to execute'
54
+ long: "--vro-workflow-id WORKFLOW_ID",
55
+ description: "ID of the workflow to execute"
56
56
 
57
57
  option :request_timeout,
58
- long: '--request-timeout SECONDS',
59
- description: 'number of seconds to wait for the workflow to complete',
58
+ long: "--request-timeout SECONDS",
59
+ description: "number of seconds to wait for the workflow to complete",
60
60
  default: 300
61
61
 
62
62
  def verify_ssl?
63
- !locate_config_value(:vro_disable_ssl_verify)
63
+ !config[:vro_disable_ssl_verify]
64
64
  end
65
65
 
66
66
  def vro_config
67
67
  @vro_config ||= VcoWorkflows::Config.new(
68
- url: locate_config_value(:vro_base_url),
69
- username: locate_config_value(:vro_username),
70
- password: locate_config_value(:vro_password),
68
+ url: config[:vro_base_url],
69
+ username: config[:vro_username],
70
+ password: config[:vro_password],
71
71
  verify_ssl: verify_ssl?
72
72
  )
73
73
  end
@@ -82,7 +82,7 @@ class Chef
82
82
 
83
83
  def parse_and_validate_params!(args)
84
84
  args.each_with_object({}) do |arg, memo|
85
- key, value = arg.split('=')
85
+ key, value = arg.split("=")
86
86
  raise "Invalid parameter, must be in KEY=VALUE format: #{arg}" if key.nil? || value.nil?
87
87
 
88
88
  memo[key] = value
@@ -105,7 +105,7 @@ class Chef
105
105
  end
106
106
 
107
107
  def wait_for_workflow
108
- wait_time = locate_config_value(:request_timeout)
108
+ wait_time = config[:request_timeout]
109
109
  Timeout.timeout(wait_time) do
110
110
  loop do
111
111
  token = vro_client.token
@@ -119,18 +119,17 @@ class Chef
119
119
  end
120
120
 
121
121
  def missing_config_parameters
122
- %i[vro_username vro_password vro_base_url].each_with_object([]) do |param, memo|
123
- memo << param if locate_config_value(param).nil?
122
+ %i{vro_username vro_password vro_base_url}.each_with_object([]) do |param, memo|
123
+ memo << param if config[param].nil?
124
124
  end
125
125
  end
126
126
 
127
127
  def validate!
128
128
  unless missing_config_parameters.empty?
129
- print_error_and_exit('The following parameters are missing but required:' \
130
- "#{missing_config_parameters.join(', ')}")
129
+ print_error_and_exit("The following parameters are missing but required:" \
130
+ "#{missing_config_parameters.join(", ")}")
131
131
  end
132
-
133
- print_error_and_exit('You must supply a workflow name.') if @name_args.empty?
132
+ print_error_and_exit("You must supply a workflow name.") if @name_args.empty?
134
133
  end
135
134
 
136
135
  def print_error_and_exit(msg)
@@ -139,7 +138,7 @@ class Chef
139
138
  end
140
139
 
141
140
  def print_results
142
- ui.msg('')
141
+ ui.msg("")
143
142
  print_output_parameters
144
143
  print_execution_log
145
144
  end
@@ -148,24 +147,24 @@ class Chef
148
147
  token = vro_client.token
149
148
  return if token.output_parameters.empty?
150
149
 
151
- ui.msg(ui.color('Output Parameters:', :bold))
150
+ ui.msg(ui.color("Output Parameters:", :bold))
152
151
  token.output_parameters.each do |k, v|
153
152
  msg_pair(k, "#{v.value} (#{v.type})") unless v.value.nil? || (v.value.respond_to?(:empty?) && v.value.empty?)
154
153
  end
155
- ui.msg('')
154
+ ui.msg("")
156
155
  end
157
156
 
158
157
  def print_execution_log
159
158
  log = vro_client.log.to_s
160
159
  return if log.nil? || log.empty?
161
160
 
162
- ui.msg(ui.color('Workflow Execution Log:', :bold))
161
+ ui.msg(ui.color("Workflow Execution Log:", :bold))
163
162
  ui.msg(log)
164
163
  end
165
164
 
166
165
  def set_parameters
167
166
  self.workflow_name = @name_args.shift
168
- self.workflow_id = locate_config_value(:vro_workflow_id)
167
+ self.workflow_id = config[:vro_workflow_id]
169
168
  self.parameters = parse_and_validate_params!(@name_args)
170
169
  end
171
170
 
@@ -174,13 +173,13 @@ class Chef
174
173
 
175
174
  set_parameters
176
175
 
177
- ui.msg('Starting workflow execution...')
176
+ ui.msg("Starting workflow execution...")
178
177
  execution_id = execute_workflow
179
178
 
180
179
  ui.msg("Workflow execution #{execution_id} started. Waiting for it to complete...")
181
180
  wait_for_workflow
182
181
 
183
- ui.msg('Workflow execution complete.')
182
+ ui.msg("Workflow execution complete.")
184
183
 
185
184
  print_results
186
185
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,5 +19,5 @@
19
19
  #
20
20
 
21
21
  module KnifeVrealize
22
- VERSION = '3.0.0'
22
+ VERSION = "6.0.0"
23
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: 3.0.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Chef Partner Engineering
7
+ - Chef Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-15 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: cookstyle
14
+ name: knife-cloud
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: knife-cloud
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
28
  - !ruby/object:Gem::Version
33
29
  version: 1.2.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
30
+ - - "<"
39
31
  - !ruby/object:Gem::Version
40
- version: 1.2.0
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
- - !ruby/object:Gem::Dependency
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
- - partnereng@chef.io
77
+ - oss@chef.io
142
78
  executables: []
143
79
  extensions: []
144
80
  extra_rdoc_files: []
145
81
  files:
146
- - ".github/ISSUE_TEMPLATE.md"
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
- - spec/spec_helper.rb
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 2.0
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: '0'
105
+ version: '2.6'
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
- rubyforge_project:
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: []