Open sbrar7 opened 6 years ago
@sbrar7 You are correct in that we have not tested this gem with an XaaS blueprint. However the changes in v2.7.0 of the vmware-vra
gem may allow you to request an XaaS blueprint from the catalog. We would be grateful if you could retry with this gem (i.e. gem install vmware-vra -v 2.7.0
) and provide any error messages if you get them so we can consider what needs to be done for a future release. Thanks!
Have anyone tested the version 2.7.0 for xaas- blueprint?
@stuartpreston . wrt sbrar7, we tried using the vmware-vra gem version 2.7.0 on xaas blueprint using the kitchen.yml stated below. We are trying to pass the extra_parameters to vra. But we are getting " Message: Failed to complete #create action: [undefined method `[]' for nil:NilClass]. while running kitchen create. " Versions: Version of vmware-vra: 2.7.0 Version of kitchen-vra: 2.6.0 Version of chef: 13.8.5 Version of ruby: bundled with chef-client Platform Details Version of vRA: 7.3.0
.kitchen.yml
---
driver:
name: vra
chef_version: latest
privileged: true
username: <%= ENV['VRA_USER_NAME'] %>
password: <%= ENV['VRA_USER_PASSWORD'] %>
tenant: dev
base_url: ip
verify_ssl: false
catalog_id: 3b22ac18-9e98-4996-b3cb-d887dbd6ab24
requestedFor: user@domain.local
subtenant_id: f84fa74d-11b4-47f0-a563-9b0aeec75516
request_timeout: 1600000
transport:
name: winrm
verifier:
name: inspec
platforms:
- name: Windows Server 2016
driver:
catalog_id: 3b22ac18-9e98-4996-b3cb-d887dbd6ab24
subtenant_id: f84fa74d-11b4-47f0-a563-9b0aeec75516
cpus: 1
memory: 2048
lease_days: 2
requested_for: user@domain.local
notes: 'note'
description: 'description'
extra_parameters:
pattern:
type: string
value: Windows Server 2016 Image Builder
patternVersion:
type: string
value: 00.00.03
deploymentName:
type: string
value: kitchentest
site:
type: string
value: site1
zone:
type: string
value: Web
suites:
- name: default
verifier:
inspec_tests:
- test/integration/default
Error while running kitchen create
[jenkins@server]$ /opt/chefdk/embedded/bin/kitchen create -l debug
-----> Starting Kitchen (v1.24.0)
D Policyfile found at /data/testcookbook/Policyfile.rb, using Policyfile to resolve dependencies
D winrm requested, loading winrm gem (["~> 2.0"])
D winrm was already loaded.
D winrm-fs requested, loading winrm-fs gem (["~> 1.0"])
D winrm-fs is loaded.
-----> Creating <default-Windows Server 2016>...
Building vRA catalog request...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #create action: [undefined method `[]' for nil:NilClass] on default-Windows Server 2016
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
D ------Exception-------
D Class: Kitchen::ActionFailed
D Message: 1 actions failed.
>>>>>> Failed to complete #create action: [undefined method `[]' for nil:NilClass] on default-Windows Server 2016
D ----------------------
D ------Backtrace-------
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:183:in `report_errors'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:174:in `run_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command/action.rb:36:in `block in call'
D /opt/chefdk/embedded/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command/action.rb:34:in `call'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:52:in `perform'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/cli.rb:193:in `block (2 levels) in <class:CLI>'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `block in <top (required)>'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/errors.rb:171:in `with_friendly_errors'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/bin/kitchen:13:in `<top (required)>'
D /opt/chefdk/embedded/bin/kitchen:23:in `load'
D /opt/chefdk/embedded/bin/kitchen:23:in `<main>'
D ----End Backtrace-----
D -Composite Exception--
D Class: Kitchen::ActionFailed
D Message: Failed to complete #create action: [undefined method `[]' for nil:NilClass] on default-Windows Server 2016
D ----------------------
D ------Backtrace-------
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:94:in `merge_payload'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:105:in `merged_payload'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:117:in `submit'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/kitchen-vra-2.6.0/lib/kitchen/driver/vra.rb:145:in `request_server'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/kitchen-vra-2.6.0/lib/kitchen/driver/vra.rb:119:in `create'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `public_send'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `block in perform_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:551:in `synchronize_or_call'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:513:in `block in action'
D /opt/chefdk/embedded/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:512:in `action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `perform_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:394:in `create_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:381:in `block in transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:380:in `each'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:380:in `transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:129:in `create'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:197:in `public_send'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:197:in `run_action_in_thread'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
D ----End Backtrace-----
D ---Nested Exception---
D Class: Kitchen::ActionFailed
D Message: Failed to complete #create action: [undefined method `[]' for nil:NilClass]
D ----------------------
D ------Backtrace-------
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:94:in `merge_payload'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:105:in `merged_payload'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/vmware-vra-2.7.0/lib/vra/catalog_request.rb:117:in `submit'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/kitchen-vra-2.6.0/lib/kitchen/driver/vra.rb:145:in `request_server'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/kitchen-vra-2.6.0/lib/kitchen/driver/vra.rb:119:in `create'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `public_send'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `block in perform_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:551:in `synchronize_or_call'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:513:in `block in action'
D /opt/chefdk/embedded/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:512:in `action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:484:in `perform_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:394:in `create_action'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:381:in `block in transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:380:in `each'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:380:in `transition_to'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/instance.rb:129:in `create'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:197:in `public_send'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:197:in `run_action_in_thread'
D /home/jenkins/.chefdk/gem/ruby/2.5.0/gems/test-kitchen-1.24.0/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
D ----End Backtrace-----
@stuartpreston . Any update.?.
Hi Stuart,
I tried it multiple times but the same error it throws which is Nil class. It is looking for the Blueprint data (Blueprint id) for the xaas Blueprint which the xaas blueprints doesn't provide as we have a underlying composite Blueprints which gets provisioned when the Xaas Blueprint is called. The major issue revolves around the line 56 where the gem looks for the blueprint id for the catalog item. if this can be resolved then i feel it will work for xaas. Some logic has to be implemented to make gem skip reading the blueprint id for the xaas blueprints. I am also attaching the part of the gem where the build fails.
Catalog-request.rb line 49 in gem version 2.6.1,2.6.2 and line 56 in version 2.7.1 (Marked bold needs to be fixed and make the vra skip reading this for xaas)
def self.request_from_payload(client, payload_file) hash_payload = JSON.parse(File.read(payload_file)) catalog_id = hash_payload["catalogItemId"] blueprint_name = hash_payload["data"].select { |_k, v| v.is_a?(Hash) }.keys.first blueprint_data = hash_payload["data"][blueprint_name] opts = {} opts[:cpus] = blueprint_data["data"]["cpu"] opts[:memory] = blueprint_data["data"]["memory"] opts[:requested_for] = hash_payload["requestedFor"] opts[:lease_days] = blueprint_data.fetch("leaseDays", nil) || hash_payload[" data"].fetch("_lease_days", 1) opts[:description] = hash_payload["description"] opts[:subtenant_id] = hash_payload["businessGroupId"] cr = Vra::CatalogRequest.new(client, catalog_id, opts) cr.template_payload = File.read(payload_file) cr end
On Fri, Jun 7, 2019 at 1:35 AM mithujose notifications@github.com wrote:
@stuartpreston https://github.com/stuartpreston . Any update.?. I hope the feature request will be implemented soon and hope to solve our issue.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chef-partners/vmware-vra-gem/issues/72?email_source=notifications&email_token=AKU6QSKKDGLUJ66GMBPOMNLPZHXTFA5CNFSM4GG3R5QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXE4NPI#issuecomment-499762877, or mute the thread https://github.com/notifications/unsubscribe-auth/AKU6QSPBDVHLLQMJ4B7DLQTPZHXTFANCNFSM4GG3R5QA .
The gem looks for Blueprint data within the blueprint name assigned. This if can be skipped for xaas blueprints should make it work. i am posting the block where this comes into picture. def self.request_from_payload(client, payload_file) hash_payload = JSON.parse(File.read(payload_file)) catalog_id = hash_payload["catalogItemId"] blueprint_name = hash_payload["data"].select { |_k, v| v.is_a?(Hash) }.keys.first blueprint_data = hash_payload["data"][blueprint_name] opts = {} opts[:cpus] = blueprint_data["data"]["cpu"] opts[:memory] = blueprint_data["data"]["memory"] opts[:requested_for] = hash_payload["requestedFor"] opts[:lease_days] = blueprint_data.fetch("leaseDays", nil) || hash_payload["data"].fetch("_lease_days", 1) opts[:description] = hash_payload["description"] opts[:subtenant_id] = hash_payload["businessGroupId"] cr = Vra::CatalogRequest.new(client, catalog_id, opts) cr.template_payload = File.read(payload_file) cr end
@stuartpreston https://github.com/stuartpreston As reported below, there are still issues after the latest changes to the plugin. Can you pls help here.
Thanks
On Fri, 7 Jun 2019 at 3:35 pm mithujose notifications@github.com wrote:
@stuartpreston https://github.com/stuartpreston . Any update.?. I hope the feature request will be implemented soon and hope to solve our issue.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chef-partners/vmware-vra-gem/issues/72?email_source=notifications&email_token=AIZ2OYLUO3XGWRCP2GQLFTLPZHXTFA5CNFSM4GG3R5QKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXE4NPI#issuecomment-499762877, or mute the thread https://github.com/notifications/unsubscribe-auth/AIZ2OYMAXYWOQVN2KMJAA4TPZHXTFANCNFSM4GG3R5QA .
Hi - thanks for the message but I am not dedicated to fixing this problem at the moment due to other project work, there is no committed timeline for adding Xaas support but we're very aware more are more environments are using Xaas blueprints and so hope to tackle it ourselves unless someone has the environment in which to test and contribute the relevant fixes. Thanks
Versions:
Platform Details
Scenario:
We are using an XaaS based blueprint rather than the composite blueprint(IaaS) and we are trying to use the gem to provision a vm with kitchen using the vra driver but it fails. It works for IaaS based pattern though.
Steps to Reproduce:
Use a kitchen config with vra driver and an xaas catalog item to provision a vm. `— driver: name: vra username:
password:
tenant: dev
base_url: https://dev.cloud.vra.com
verify_ssl: false
catalog_name: "Linux"
catalog_id: "02e8c875-2000-4311-aa17-1baf663f3263"
requestedFor: "user@vsphere.local"
subtenant_id: "e6c74449-5da5-4414-b319-61d62a1b"
extra_parameters:
AdditionalDiskRequired:
type: string
value: false
Backup:
type: string
value: true
Deployment:
type: string
value: "TerraForm"
Environment:
type: string
value: "Production"
OSversion:
type: string
value: "RHEL 7.3"
Site:
type: string
value: "Site01"
Size:
type: string
value: "MEDIUM1_4CPU_8GBRAM_40GBDISK"
SupportTier:
type: string
value: "Low Touch"
Zone:
type: string
value: "Web and Application Zone"
NumberOfInstances:
type: integer
value: 1
platforms:
name: Linux suites:
name: default run_list: recipe[java::default] verifier: inspec_tests: test/smoke/default attributes:`
Expected Result:
A virtual machine should get provisioned from the requested catalog id which is based on XaaS format.
Actual Result:
It fails to create the same as I believe the gem is designed for IaaS format.