Skip to content

Commit

Permalink
Unique name for the newly provisioned VMs. (#66)
Browse files Browse the repository at this point in the history
* update version  

Signed-off-by: Rupesh0688 <[email protected]>

* unique name for new VM provision by passing unique_name as true  

Signed-off-by: Rupesh0688 <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Rupesh0688 <[email protected]>

* Chefstyle resolve

Signed-off-by: Rupesh0688 <[email protected]>

* Updated chefstyle issues 

Signed-off-by: Rupesh0688 <[email protected]>

* Minor changes in the params building

Signed-off-by: Ashique P S <[email protected]>

---------

Signed-off-by: Rupesh0688 <[email protected]>
Signed-off-by: Ashique P S <[email protected]>
Co-authored-by: Rupesh0688 <[email protected]>
  • Loading branch information
ashiqueps and Rupesh0688 authored Jul 5, 2023
1 parent 2913dcb commit 6ca4d6d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [v3.3.2](https://github.com/chef-partners/kitchen-vra/tree/v3.3.2)

[Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.3.1...v3.3.2)

- This change helps in getting unique name of a deployment. The new deployement name will be deployment_deploymentId. We need to pass **unique_name** as true(unique_name: true) in the driver configuration.

## [v3.3.1](https://github.com/chef-partners/kitchen-vra/tree/v3.3.1)

[Full Changelog](https://github.com/chef-partners/kitchen-vra/compare/v3.3.0...v3.3.1)
Expand Down
9 changes: 7 additions & 2 deletions lib/kitchen/driver/vra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Vra < Kitchen::Driver::Base # rubocop:disable Metrics/ClassLength
default_config :request_timeout, 600
default_config :request_refresh_rate, 2
default_config :server_ready_retries, 1
default_config :unique_name, false
default_config :deployment_name do |driver|
driver&.instance&.platform&.name
end
Expand Down Expand Up @@ -152,6 +153,9 @@ def request_server
deployment_request = catalog_request.submit

info("Catalog request #{deployment_request.id} submitted.")
if config[:unique_name]
info("Deployment name is deployment_#{deployment_request.id}")
end

wait_for_request(deployment_request)
raise "The vRA request failed: #{deployment_request.completion_details}" if deployment_request.failed?
Expand Down Expand Up @@ -232,10 +236,11 @@ def catalog_request # rubocop:disable Metrics/MethodLength
deployment_params = {
image_mapping: config[:image_mapping],
flavor_mapping: config[:flavor_mapping],
name: config[:deployment_name],
project_id: config[:project_id],
version: config[:version],
}
}.tap do |h|
h[:name] = config[:deployment_name] unless config[:unique_name]
end

catalog_request = vra_client.catalog.request(config[:catalog_id], deployment_params)

Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/vra_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

module Kitchen
module Driver
VRA_VERSION = "3.3.1"
VRA_VERSION = "3.3.2"
end
end

0 comments on commit 6ca4d6d

Please sign in to comment.