class AnsibleTowerClient::JobTemplate
Constants
- REQUIRED_ATTRIBUTES_FOR_OPTIONS
Public Instance Methods
extra_vars_hash()
click to toggle source
# 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 = {})
click to toggle source
# 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_attributes()
click to toggle source
# 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_spec()
click to toggle source
# 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_hash()
click to toggle source
# File lib/ansible_tower_client/base_models/job_template.rb, line 29 def survey_spec_hash survey_spec.nil? ? {} : hashify(:survey_spec) end
Private Instance Methods
validate_launch_options(options)
click to toggle source
# File lib/ansible_tower_client/base_models/job_template.rb, line 43 def validate_launch_options(options) ignored_options = REQUIRED_ATTRIBUTES_FOR_OPTIONS.select do |option, checkmark| options.values_at(option.to_sym, option.to_s).any?(&:present?) && !(respond_to?(checkmark) && send(checkmark)) end.keys return if ignored_options.empty? raise ArgumentError, "'PROMPT ON LAUNCH' is required for the following fields: #{ignored_options.join(', ')}" end