Class: AnsibleTowerClient::JobTemplate

Inherits:
BaseModel show all
Defined in:
lib/ansible_tower_client/base_models/job_template.rb

Direct Known Subclasses

JobTemplateV2, WorkflowJobTemplate

Instance Attribute Summary

Attributes inherited from BaseModel

#api, #raw_hash

Instance Method Summary collapse

Methods inherited from BaseModel

base_class, create, create!, #destroy, #destroy!, endpoint, #hashify, #initialize, #save, #save!, #update_attributes, #update_attributes!

Methods inherited from HashModel

#==, #[], #initialize, #inspect, #to_h, #to_json

Constructor Details

This class inherits a constructor from AnsibleTowerClient::BaseModel

Instance Method Details

#extra_vars_hashObject



33
34
35
# File 'lib/ansible_tower_client/base_models/job_template.rb', line 33

def extra_vars_hash
  extra_vars.empty? ? {} : hashify(:extra_vars)
end

#launch(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/ansible_tower_client/base_models/job_template.rb', line 12

def launch(options = {})
  validate_launch_options(options)

  launch_url = "#{url}launch/"
  response   = api.post(launch_url, options).body
  job        = JSON.parse(response)

  api.jobs.find(job['job'])
end

#override_raw_attributesObject



37
38
39
# File 'lib/ansible_tower_client/base_models/job_template.rb', line 37

def override_raw_attributes
  { :credential => :credential_id, :inventory => :inventory_id, :project => :project_id }
end

#survey_specObject



22
23
24
25
26
27
# File 'lib/ansible_tower_client/base_models/job_template.rb', line 22

def survey_spec
  spec_url = related['survey_spec']
  return nil unless spec_url
  api.get(spec_url).body
rescue AnsibleTowerClient::UnlicensedFeatureError
end

#survey_spec_hashObject



29
30
31
# File 'lib/ansible_tower_client/base_models/job_template.rb', line 29

def survey_spec_hash
  survey_spec.nil? ? {} : hashify(:survey_spec)
end