Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin does not support xaas format #72

Open
sbrar7 opened this issue Nov 28, 2018 · 8 comments
Open

Plugin does not support xaas format #72

sbrar7 opened this issue Nov 28, 2018 · 8 comments

Comments

@sbrar7
Copy link

sbrar7 commented Nov 28, 2018

Versions:

  • Version of vmware-vra-gem: 2.6.0
  • Version of chef: 13.8.5
  • Version of ruby: bundled with chef-client

Platform Details

  • Version of vRA: 7.3.0
  • Version of ESXi:

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: "[email protected]"
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.

@stuartpreston
Copy link

@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!

@Bharat2190
Copy link

Have anyone tested the version 2.7.0 for xaas- blueprint?

@mithujose
Copy link

@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: [email protected]
  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: [email protected]
      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-----


@mithujose
Copy link

mithujose commented Jun 7, 2019

@stuartpreston . Any update.?.

@Bharat2190
Copy link

Bharat2190 commented Jun 7, 2019 via email

@Bharat2190
Copy link

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

@sbrar7
Copy link
Author

sbrar7 commented Jun 7, 2019 via email

@stuartpreston
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants