knife-vrealize 5.0.2 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc3c96c272f00e8d5bc3922de2db7b6ae0955d9cb7520c18e8ab64c882ea3312
4
- data.tar.gz: 7f74f3e6e96c360d807358fc4b3ecc29cea6d4b3758e9d2c3b752f44edad114b
3
+ metadata.gz: 26774900025bacb20c92669ec354fa5eecf896a05e5dc0360639bc3c58b58998
4
+ data.tar.gz: c374fd4befb4616243716ddd664a509f13c33d9a1254d1c0af3985103604c7dd
5
5
  SHA512:
6
- metadata.gz: 05aee0b54656edde368d422c94957a8266e5d88170fbb033669b15a3a47f2b91dd4bf0961180e6565f5c3c8f0db52c3e5ec5b9be8b4220812b4c16397376806f
7
- data.tar.gz: e5e1f2fcec20fb0af51ccac43d9923868220fdbdf748092c009b2a568d1a4cb302ae57f416564b81cf8e9a0180303dc4f5ab1d5f4b8aa762ba20cb791fda0180
6
+ metadata.gz: 29be7394fb628f6ff10f98e63b3d4a01ec3ab7bcdc8d23c35140dc754481051be09bd9668ce2f73ee169d9f380197c8114bf611e90e9e6fcb142ff0cbfaf2a94
7
+ data.tar.gz: 48870906b9cc159ff4c95faac60f3a4a1e8657b9b1f82003e0441534eb1b2fda359fba59869b0502b6e67cbf3631e1674f51e3fa3be635dd25bd1a70a7a454ef
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -30,7 +30,7 @@ class Chef
30
30
  class VraService < Service
31
31
  include VraServiceHelpers
32
32
  def initialize(options = {})
33
- super(options)
33
+ super(config: options)
34
34
 
35
35
  @username = options[:username]
36
36
  @password = options[:password]
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -27,16 +27,16 @@ class Chef
27
27
  include Chef::Knife::Cloud::Helpers
28
28
 
29
29
  def create_service_instance
30
- Chef::Knife::Cloud::VraService.new(username: locate_config_value(:vra_username),
31
- password: locate_config_value(:vra_password),
32
- base_url: locate_config_value(:vra_base_url),
33
- tenant: locate_config_value(:vra_tenant),
34
- page_size: locate_config_value(:vra_page_size),
30
+ Chef::Knife::Cloud::VraService.new(username: config[:vra_username],
31
+ password: config[:vra_password],
32
+ base_url: config[:vra_base_url],
33
+ tenant: config[:vra_tenant],
34
+ page_size: config[:vra_page_size],
35
35
  verify_ssl: verify_ssl?)
36
36
  end
37
37
 
38
38
  def verify_ssl?
39
- !locate_config_value(:vra_disable_ssl_verify)
39
+ !config[:vra_disable_ssl_verify]
40
40
  end
41
41
 
42
42
  def wait_for_request(request, wait_time = 600, refresh_rate = 2)
@@ -78,7 +78,7 @@ class Chef
78
78
 
79
79
  # rubocop:disable Style/GuardClause
80
80
  def check_for_missing_config_values!(*keys)
81
- missing = keys.select { |x| locate_config_value(x).nil? }
81
+ missing = keys.select { |x| config[x].nil? }
82
82
 
83
83
  unless missing.empty?
84
84
  ui.error("The following required parameters are missing: #{missing.join(", ")}")
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -20,19 +20,22 @@
20
20
 
21
21
  require "chef/knife"
22
22
  require "chef/knife/cloud/list_resource_command"
23
- require_relative "cloud/vra_service"
24
- require_relative "cloud/vra_service_helpers"
25
23
  require_relative "cloud/vra_service_options"
26
24
 
27
25
  class Chef
28
26
  class Knife
29
27
  class Cloud
30
28
  class VraCatalogList < ResourceListCommand
31
- include VraServiceHelpers
32
29
  include VraServiceOptions
33
30
 
34
31
  banner "knife vra catalog list"
35
32
 
33
+ deps do
34
+ require_relative "cloud/vra_service"
35
+ require_relative "cloud/vra_service_helpers"
36
+ include VraServiceHelpers
37
+ end
38
+
36
39
  option :entitled,
37
40
  long: "--entitled-only",
38
41
  description: "only list entitled vRA catalog entries",
@@ -52,10 +55,12 @@ class Chef
52
55
  end
53
56
 
54
57
  def query_resource
55
- @service.list_catalog_items(locate_config_value(:entitled))
58
+ @service.list_catalog_items(config[:entitled])
56
59
  end
57
60
 
58
61
  def format_status_value(status)
62
+ return "-" if status.nil?
63
+
59
64
  status = status.downcase
60
65
  color = if status == "published"
61
66
  :green
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -21,8 +21,6 @@
21
21
  require "chef/knife"
22
22
  require "chef/knife/cloud/server/create_command"
23
23
  require "chef/knife/cloud/server/create_options"
24
- require_relative "cloud/vra_service"
25
- require_relative "cloud/vra_service_helpers"
26
24
  require_relative "cloud/vra_service_options"
27
25
 
28
26
  class Chef
@@ -35,6 +33,11 @@ class Chef
35
33
 
36
34
  banner "knife vra server create CATALOG_ID (options)"
37
35
 
36
+ deps do
37
+ require_relative "cloud/vra_service"
38
+ require_relative "cloud/vra_service_helpers"
39
+ end
40
+
38
41
  option :cpus,
39
42
  long: "--cpus NUM_CPUS",
40
43
  description: "Number of CPUs the server should have"
@@ -97,22 +100,22 @@ class Chef
97
100
 
98
101
  @create_options = {
99
102
  catalog_id: @name_args.first,
100
- cpus: locate_config_value(:cpus),
101
- memory: locate_config_value(:memory),
102
- requested_for: locate_config_value(:requested_for),
103
- subtenant_id: locate_config_value(:subtenant_id),
104
- lease_days: locate_config_value(:lease_days),
105
- notes: locate_config_value(:notes),
103
+ cpus: config[:cpus],
104
+ memory: config[:memory],
105
+ requested_for: config[:requested_for],
106
+ subtenant_id: config[:subtenant_id],
107
+ lease_days: config[:lease_days],
108
+ notes: config[:notes],
106
109
  extra_params: extra_params,
107
- wait_time: locate_config_value(:server_create_timeout),
108
- refresh_rate: locate_config_value(:request_refresh_rate),
110
+ wait_time: config[:server_create_timeout],
111
+ refresh_rate: config[:request_refresh_rate],
109
112
  }
110
113
  end
111
114
 
112
115
  def before_bootstrap
113
116
  super
114
117
 
115
- config[:chef_node_name] = locate_config_value(:chef_node_name) ? locate_config_value(:chef_node_name) : server.name
118
+ config[:chef_node_name] = config[:chef_node_name] ? config[:chef_node_name] : server.name
116
119
  config[:bootstrap_ip_address] = hostname_for_server
117
120
  end
118
121
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -21,8 +21,6 @@
21
21
  require "chef/knife"
22
22
  require "chef/knife/cloud/server/delete_options"
23
23
  require "chef/knife/cloud/server/delete_command"
24
- require_relative "cloud/vra_service"
25
- require_relative "cloud/vra_service_helpers"
26
24
  require_relative "cloud/vra_service_options"
27
25
 
28
26
  class Chef
@@ -30,11 +28,16 @@ class Chef
30
28
  class Cloud
31
29
  class VraServerDelete < ServerDeleteCommand
32
30
  include ServerDeleteOptions
33
- include VraServiceHelpers
34
31
  include VraServiceOptions
35
32
 
36
33
  banner "knife vra server delete RESOURCE_ID [RESOURCE_ID] (options)"
37
34
 
35
+ deps do
36
+ require_relative "cloud/vra_service"
37
+ require_relative "cloud/vra_service_helpers"
38
+ include VraServiceHelpers
39
+ end
40
+
38
41
  # rubocop:disable Style/GuardClause
39
42
  def validate_params!
40
43
  if @name_args.empty?
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -21,19 +21,22 @@
21
21
  require "chef/knife"
22
22
  require "chef/knife/cloud/server/list_command"
23
23
  require "chef/knife/cloud/server/list_options"
24
- require_relative "cloud/vra_service"
25
- require_relative "cloud/vra_service_helpers"
26
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
32
  banner "knife vra server list"
36
33
 
34
+ deps do
35
+ require_relative "cloud/vra_service"
36
+ require_relative "cloud/vra_service_helpers"
37
+ include VraServiceHelpers
38
+ end
39
+
37
40
  def before_exec_command
38
41
  @columns_with_info = [
39
42
  { label: "Resource ID", key: "id" },
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -21,8 +21,6 @@
21
21
  require "chef/knife"
22
22
  require "chef/knife/cloud/server/show_options"
23
23
  require "chef/knife/cloud/server/show_command"
24
- require_relative "cloud/vra_service"
25
- require_relative "cloud/vra_service_helpers"
26
24
  require_relative "cloud/vra_service_options"
27
25
 
28
26
  class Chef
@@ -30,11 +28,16 @@ class Chef
30
28
  class Cloud
31
29
  class VraServerShow < ServerShowCommand
32
30
  include ServerShowOptions
33
- include VraServiceHelpers
34
31
  include VraServiceOptions
35
32
 
36
33
  banner "knife vra server show RESOURCE_ID (options)"
37
34
 
35
+ deps do
36
+ require_relative "cloud/vra_service"
37
+ require_relative "cloud/vra_service_helpers"
38
+ include VraServiceHelpers
39
+ end
40
+
38
41
  def validate_params!
39
42
  if @name_args.empty?
40
43
  ui.error("You must supply a Resource ID for a server to display.")
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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");
@@ -60,14 +60,14 @@ class Chef
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
@@ -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
@@ -120,7 +120,7 @@ class Chef
120
120
 
121
121
  def missing_config_parameters
122
122
  %i{vro_username vro_password vro_base_url}.each_with_object([]) do |param, memo|
123
- memo << param if locate_config_value(param).nil?
123
+ memo << param if config[param].nil?
124
124
  end
125
125
  end
126
126
 
@@ -129,7 +129,6 @@ class Chef
129
129
  print_error_and_exit("The following parameters are missing but required:" \
130
130
  "#{missing_config_parameters.join(", ")}")
131
131
  end
132
-
133
132
  print_error_and_exit("You must supply a workflow name.") if @name_args.empty?
134
133
  end
135
134
 
@@ -165,7 +164,7 @@ class Chef
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: 2015-2019, 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 = "5.0.2"
22
+ VERSION = "6.0.0"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vrealize
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-08 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
14
  name: knife-cloud
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: '2.5'
105
+ version: '2.6'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="