knife-vrealize 6.0.4 → 7.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: 0d4dafa146bc6df4768a50e5c1b23dfcebcd681e9ae6ef051730ff0a277e3689
4
- data.tar.gz: 4fa38fb23055ff6e23952a975410605153051ac831e48b6ea1398427072abc6f
3
+ metadata.gz: 82a3ba6a329237518849cf8dd289a8bb419a44a0625bd4cb2749fc5703b96cac
4
+ data.tar.gz: '0835ab33c89a8c15910ad3a413cd32e6fe561a052fb4dc6591005290a6f71577'
5
5
  SHA512:
6
- metadata.gz: bc2207db033c162545c15093010be180fffa0d9ee173687dad160e22a4f913de9765d0d8d2014864025aa53b81335cb0088f243175c69f168b54e269f5bf8569
7
- data.tar.gz: 9ec9d6219ff4074a6d40d1a3620e6694c7f012617499ed71e80594a3615180918c1e2dc5206502b211ba1e12badacfb2e67b2caa5183c309529aafb995dcf5a5
6
+ metadata.gz: eb42ddad92fa6beb58a3f8147bc7c0d10e6f85cbbdc42ccb88cb365252aa4a16fed10233c895ee5b6e01a195df5c08efc3b2b84c043c2558f9a53fd03cf4f2e0
7
+ data.tar.gz: b2a456df3b78bf29156eaab3d35b09a9286c7624c24de77dd580e9f5870025ac787ead37ac296ff05527a4fccb7b528c8619078c9557557d6073f899176f13ad
@@ -54,11 +54,11 @@ class Chef
54
54
  def create_server(options = {})
55
55
  submitted_request = catalog_request(options).submit
56
56
  ui.msg("Catalog request #{submitted_request.id} submitted.")
57
- wait_for_request(submitted_request, options[:wait_time].to_i, options[:refresh_rate])
57
+ wait_for_request(submitted_request, (options[:wait_time] || 600).to_i, options[:refresh_rate] || 2)
58
58
  ui.msg("Catalog request complete.\n")
59
59
  request_summary(submitted_request)
60
60
 
61
- raise CloudExceptions::ServerCreateError, submitted_request.completion_details if submitted_request.failed?
61
+ raise CloudExceptions::ServerCreateError if submitted_request.failed?
62
62
 
63
63
  servers = submitted_request.resources.select(&:vm?)
64
64
  raise CloudExceptions::ServerCreateError, "The vRA request created more than one server, but we were only expecting 1" if servers.length > 1
@@ -67,8 +67,9 @@ class Chef
67
67
  servers.first
68
68
  end
69
69
 
70
- def delete_server(instance_id)
71
- server = get_server(instance_id)
70
+ def delete_server(deployment_id)
71
+ deployment = get_deployment(deployment_id)
72
+ server = deployment.resources.select(&:vm?).first
72
73
  server_summary(server)
73
74
  ui.msg("")
74
75
 
@@ -79,7 +80,7 @@ class Chef
79
80
 
80
81
  ui.confirm("Do you really want to delete this server")
81
82
 
82
- destroy_request = server.destroy
83
+ destroy_request = deployment.destroy
83
84
  ui.msg("Destroy request #{destroy_request.id} submitted.")
84
85
  wait_for_request(destroy_request)
85
86
  ui.msg("Destroy request complete.")
@@ -87,48 +88,50 @@ class Chef
87
88
  end
88
89
 
89
90
  def list_servers
90
- connection.resources.all_resources.select(&:vm?)
91
+ connection.deployments.all
91
92
  end
92
93
 
93
- def list_catalog_items(entitled)
94
+ def list_catalog_items(project_id, entitled)
94
95
  if entitled
95
- connection.catalog.entitled_items
96
+ connection.catalog.entitled_items(project_id)
96
97
  else
97
98
  connection.catalog.all_items
98
99
  end
99
100
  end
100
101
 
101
- def get_server(instance_id)
102
- connection.resources.by_id(instance_id)
102
+ def get_deployment(deployment_id)
103
+ connection.deployments.by_id(deployment_id)
104
+ end
105
+
106
+ def get_server(deployment_id)
107
+ deployment = connection.deployments.by_id(deployment_id)
108
+ deployment.resources.select(&:vm?).first
103
109
  end
104
110
 
105
111
  def server_summary(server, _columns_with_info = nil)
106
- msg_pair("Server ID", server.id)
107
- msg_pair("Server Name", server.name)
108
- msg_pair("IP Addresses", server.ip_addresses.nil? ? "none" : server.ip_addresses.join(", "))
112
+ deployment = connection.deployments.by_id(server.deployment_id)
113
+ msg_pair("Deployment ID", deployment.id)
114
+ msg_pair("Deployment Name", deployment.name)
115
+ msg_pair("IP Address", server.ip_address.nil? ? "none" : server.ip_address)
109
116
  msg_pair("Status", server.status)
110
- msg_pair("Catalog Name", server.catalog_name)
111
- msg_pair("Owner IDs", server.owner_ids.empty? ? "none" : server.owner_ids.join(", "))
112
- msg_pair("Owner Names", server.owner_names.empty? ? "none" : server.owner_names.join(", "))
117
+ msg_pair("Owner Names", server.owner_names.empty? ? "none" : server.owner_names)
113
118
  end
114
119
 
115
120
  def request_summary(request)
116
121
  ui.msg("")
117
122
  msg_pair("Request Status", request.status)
118
- msg_pair("Completion State", request.completion_state)
119
- msg_pair("Completion Details", request.completion_details)
120
123
  ui.msg("")
121
124
  end
122
125
 
123
126
  def catalog_request(options)
124
127
  catalog_request = connection.catalog.request(options[:catalog_id])
125
128
 
126
- catalog_request.cpus = options[:cpus]
127
- catalog_request.memory = options[:memory]
128
- catalog_request.requested_for = options[:requested_for]
129
- catalog_request.lease_days = options[:lease_days] unless options[:lease_days].nil?
130
- catalog_request.notes = options[:notes] unless options[:notes].nil?
131
- catalog_request.subtenant_id = options[:subtenant_id] unless options[:subtenant_id].nil?
129
+ catalog_request.image_mapping = options[:image_mapping]
130
+ catalog_request.flavor_mapping = options[:flavor_mapping]
131
+ catalog_request.name = options[:name]
132
+ catalog_request.project_id = options[:project_id]
133
+ catalog_request.version = options[:version] unless options[:version].nil?
134
+
132
135
  options[:extra_params]&.each do |param|
133
136
  catalog_request.set_parameter(param[:key], param[:type], param[:value])
134
137
  end
@@ -36,6 +36,10 @@ class Chef
36
36
  include VraServiceHelpers
37
37
  end
38
38
 
39
+ option :project_id,
40
+ long: "--project-id",
41
+ description: "Catalogs are retrieved using the Project ID"
42
+
39
43
  option :entitled,
40
44
  long: "--entitled-only",
41
45
  description: "only list entitled vRA catalog entries",
@@ -47,15 +51,14 @@ class Chef
47
51
  { label: "Catalog ID", key: "id" },
48
52
  { label: "Name", key: "name" },
49
53
  { label: "Description", key: "description" },
50
- { label: "Status", key: "status", value_callback: method(:format_status_value) },
51
- { label: "Subtenant", key: "subtenant_name" },
54
+ { label: "Source", key: "source_name" },
52
55
  ]
53
56
 
54
57
  @sort_by_field = "name"
55
58
  end
56
59
 
57
60
  def query_resource
58
- @service.list_catalog_items(config[:entitled])
61
+ @service.list_catalog_items(config[:project_id], config[:entitled])
59
62
  end
60
63
 
61
64
  def format_status_value(status)
@@ -38,38 +38,30 @@ class Chef
38
38
  require_relative "cloud/vra_service"
39
39
  end
40
40
 
41
- option :cpus,
42
- long: "--cpus NUM_CPUS",
43
- description: "Number of CPUs the server should have"
41
+ option :project_id,
42
+ long: "--project-id PROJECT_ID",
43
+ description: "ID of the project"
44
44
 
45
- option :node_ssl_verify_mode,
46
- long: "--node-ssl-verify-mode [peer|none]",
47
- description: "Whether or not to verify the SSL cert for all HTTPS requests when bootstrapping"
48
- option :memory,
49
- long: "--memory RAM_IN_MB",
50
- description: "Amount of RAM, in MB, the server should have"
51
-
52
- option :requested_for,
53
- long: "--requested-for LOGIN",
54
- description: "The login to list as the owner of this resource. Will default to the vra_username parameter"
45
+ option :image_mapping,
46
+ long: "--image-mapping IMAGE_MAPPING",
47
+ description: "Specifies the OS image for the new VM"
55
48
 
56
49
  option :server_create_timeout,
57
50
  long: "--server-create-timeout SECONDS",
58
51
  description: "number of seconds to wait for the server to complete",
59
52
  default: 600
60
53
 
61
- option :subtenant_id,
62
- long: "--subtenant-id ID",
63
- description: 'The subtenant ID (a.k.a "business group") to list as the owner of this resource. ' \
64
- "Will default to the blueprint subtenant if it exists."
54
+ option :flavor_mapping,
55
+ long: "--flavor-mapping FLAVOR_MAPPING",
56
+ description: "Specifies the CPU count and RAM for the new VM"
65
57
 
66
- option :lease_days,
67
- long: "--lease-days NUM_DAYS",
68
- description: "Number of days requested for the server lease, provided the blueprint allows this to be specified"
58
+ option :version,
59
+ long: "--version VERSION",
60
+ description: "Specifies the version of the catalog to be used. By default the latest version will be used."
69
61
 
70
- option :notes,
71
- long: "--notes NOTES",
72
- description: "String of text to be included in the request notes."
62
+ option :name,
63
+ long: "--name NAME",
64
+ description: "Name for the newly created deployment"
73
65
 
74
66
  option :extra_params,
75
67
  long: "--extra-param KEY=TYPE:VALUE",
@@ -90,7 +82,7 @@ class Chef
90
82
  exit 1
91
83
  end
92
84
 
93
- check_for_missing_config_values!(:cpus, :memory, :requested_for)
85
+ check_for_missing_config_values!(:name, :flavor_mapping, :image_mapping, :project_id)
94
86
 
95
87
  validate_extra_params!
96
88
  end
@@ -100,15 +92,12 @@ class Chef
100
92
 
101
93
  @create_options = {
102
94
  catalog_id: @name_args.first,
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],
95
+ project_id: config[:project_id],
96
+ image_mapping: config[:image_mapping],
97
+ flavor_mapping: config[:flavor_mapping],
98
+ version: config[:version],
99
+ name: config[:name],
109
100
  extra_params: extra_params,
110
- wait_time: config[:server_create_timeout],
111
- refresh_rate: config[:request_refresh_rate],
112
101
  }
113
102
  end
114
103
 
@@ -139,7 +128,7 @@ class Chef
139
128
  end
140
129
 
141
130
  def hostname_for_server
142
- ip_address = server.ip_addresses.first
131
+ ip_address = server.ip_address
143
132
 
144
133
  ip_address.nil? ? server.name : ip_address
145
134
  end
@@ -30,7 +30,7 @@ class Chef
30
30
  include ServerDeleteOptions
31
31
  include VraServiceOptions
32
32
 
33
- banner "knife vra server delete RESOURCE_ID [RESOURCE_ID] (options)"
33
+ banner "knife vra server delete DEPLOYMENT_ID [DEPLOYMENT_ID] (options)"
34
34
 
35
35
  deps do
36
36
  require_relative "cloud/vra_service"
@@ -39,10 +39,11 @@ class Chef
39
39
 
40
40
  def before_exec_command
41
41
  @columns_with_info = [
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" },
42
+ { label: "Deployment ID", key: "id" },
43
+ { label: "Name", key: "name" },
44
+ { label: "Status", key: "status", value_callback: method(:format_status_value) },
45
+ { label: "Owner", key: "owner" },
46
+ { label: "Description", key: "description" },
46
47
  ]
47
48
 
48
49
  @sort_by_field = "name"
@@ -30,7 +30,7 @@ class Chef
30
30
  include ServerShowOptions
31
31
  include VraServiceOptions
32
32
 
33
- banner "knife vra server show RESOURCE_ID (options)"
33
+ banner "knife vra server show DEPLOYMENT_ID (options)"
34
34
 
35
35
  deps do
36
36
  require_relative "cloud/vra_service"
@@ -40,12 +40,12 @@ class Chef
40
40
 
41
41
  def validate_params!
42
42
  if @name_args.empty?
43
- ui.error("You must supply a Resource ID for a server to display.")
43
+ ui.error("You must supply a Deployment ID for a server to display.")
44
44
  exit 1
45
45
  end
46
46
 
47
47
  if @name_args.size > 1
48
- ui.error("You may only supply one Resource ID.")
48
+ ui.error("You may only supply one Deployment ID.")
49
49
  exit 1
50
50
  end
51
51
 
@@ -19,5 +19,5 @@
19
19
  #
20
20
 
21
21
  module KnifeVrealize
22
- VERSION = "6.0.4"
22
+ VERSION = "7.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: 6.0.4
4
+ version: 7.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: 2022-05-18 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knife
@@ -49,9 +49,6 @@ dependencies:
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '2'
54
- - - "<"
55
52
  - !ruby/object:Gem::Version
56
53
  version: '3'
57
54
  type: :runtime
@@ -59,9 +56,6 @@ dependencies:
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '2'
64
- - - "<"
65
59
  - !ruby/object:Gem::Version
66
60
  version: '3'
67
61
  - !ruby/object:Gem::Dependency