Class: Ogre::SetPrivateKey
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Ogre::SetPrivateKey
- Includes:
- Thor::Actions
- Defined in:
- lib/ogre/set-private-key.rb
Overview
Set Private Key is used to set a chef validation key via a vco workflow
Instance Method Summary collapse
-
#set_private_key ⇒ Object
rubocop:disable CyclomaticComplexity, PerceivedComplexity Execute vcoworkflows gem to call set private key.
Instance Method Details
#set_private_key ⇒ Object
rubocop:disable CyclomaticComplexity, PerceivedComplexity Execute vcoworkflows gem to call set private key
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ogre/set-private-key.rb', line 20 def set_private_key # get workflow # rubocop:disable AlignParameters workflow = VcoWorkflows::Workflow.new([:vco_wf_name] || Config.[:vco_wf_name], url: [:vco_url] || Config.[:vco_url], verify_ssl: [:vco_verify_ssl] || Config.[:vco_verify_ssl], username: [:vco_user] || Config.[:vco_user], password: [:vco_password] || Config.[:vco_password]) # rubocop:enable AlignParameters # set parameters workflow.parameter('chefHostname', chef_hostname) workflow.parameter('userid', chef_validator_name) workflow.parameter('pem', File.read(key_path)) # run workflow execution_id = workflow.execute # check status finished = false until finished # Fetch a new workflow token to check the status of the workflow execution wf_token = workflow.token # If the execution is no longer alive, exit the loop unless wf_token.alive? finished = true execution_id end sleep 5 end # output result log = workflow.token(execution_id).to_s puts log.slice(0..log.index('Input Parameters:') - 2) end |