ansible_tower_client 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afa572e7a5320c8c4128c1b60a256b3becdbf63b2962e126b3295b7096f7472f
4
- data.tar.gz: af3e60d79451302d1c5cfe8b9a7ee0371117370a7e002e0eccd7887f733690a3
3
+ metadata.gz: 0fba830a6fa6820737e3aa09ea88b86132c10a4f08368ccb26eed957b01d674d
4
+ data.tar.gz: ed5c4e64757f58632f17cdae613a1055907883e4a037798841ef6533fc73952d
5
5
  SHA512:
6
- metadata.gz: e4a3651e8cf033e8b1c8c2a012aa4f0013d721e458d5cb90f390c40abde1d9ec25429b653af29bf576ebea41c1be82c9cdd8ef499778472c612870be9387ef50
7
- data.tar.gz: e0217ab79d41ad8f9cb592aa42a7d7a050e8b83077992afd28ed0d65d706fbf24973efc6c7f4686441021ee0b79bed3a08db0f87cbc10a7945b1eb35ebb89bfb
6
+ metadata.gz: 5dc626b6aa63686bd5a25da898c539a2fee44e6e40a92fe576e755b58fd26e29dfa013b46d20ad32968c7aea00024b536e1ef5a0071ab3f763ea2387f4ce6d24
7
+ data.tar.gz: edaa672cb12d9309b8e0da96faaa3508902d78badc4f76b79d900700c31306ed96403c8b7a4971e0c5f5138656d5c827a5f62bfe4380df6c08273ad69e857c33
@@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.18.0] - 2018-09-13
9
+ ### Added
10
+ - Raise a helpful error message when options will be ignored in JobTemplate#launch [(#119)](https://github.com/ansible/ansible_tower_client_ruby/pull/119)
11
+
8
12
  ## [0.17.0] - 2018-07-27
9
13
  ### Removed
10
14
  - Reverted support for API v2 and v2 Credentials [(#117)](https://github.com/ansible/ansible_tower_client_ruby/pull/117)
@@ -98,7 +102,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
98
102
  ### Fixed
99
103
  - Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
100
104
 
101
- [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.17.0...master
105
+ [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.18.0...master
106
+ [0.18.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.17.0...v0.18.0
102
107
  [0.17.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.16.0...v0.17.0
103
108
  [0.16.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.15.0...v0.16.0
104
109
  [0.15.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.14.0...v0.15.0
@@ -1,9 +1,21 @@
1
1
  module AnsibleTowerClient
2
2
  class JobTemplate < BaseModel
3
+ REQUIRED_ATTRIBUTES_FOR_OPTIONS = {
4
+ :job_tags => :ask_tags_on_launch,
5
+ :job_type => :ask_job_type_on_launch,
6
+ :limit => :ask_limit_on_launch,
7
+ :inventory => :ask_inventory_on_launch,
8
+ :credential => :ask_credential_on_launch,
9
+ }.freeze
10
+ private_constant :REQUIRED_ATTRIBUTES_FOR_OPTIONS
11
+
3
12
  def launch(options = {})
13
+ validate_launch_options(options)
14
+
4
15
  launch_url = "#{url}launch/"
5
16
  response = api.post(launch_url, options).body
6
17
  job = JSON.parse(response)
18
+
7
19
  api.jobs.find(job['job'])
8
20
  end
9
21
 
@@ -25,5 +37,17 @@ module AnsibleTowerClient
25
37
  def override_raw_attributes
26
38
  { :credential => :credential_id, :inventory => :inventory_id, :project => :project_id }
27
39
  end
40
+
41
+ private
42
+
43
+ def validate_launch_options(options)
44
+ ignored_options = REQUIRED_ATTRIBUTES_FOR_OPTIONS.select do |option, checkmark|
45
+ options.values_at(option.to_sym, option.to_s).any?(&:present?) && !(respond_to?(checkmark) && send(checkmark))
46
+ end.keys
47
+
48
+ return if ignored_options.empty?
49
+
50
+ raise ArgumentError, "'PROMPT ON LAUNCH' is required for the following fields: #{ignored_options.join(', ')}"
51
+ end
28
52
  end
29
53
  end
@@ -1,3 +1,3 @@
1
1
  module AnsibleTowerClient
2
- VERSION = "0.17.0".freeze
2
+ VERSION = "0.18.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_tower_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dunne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-07-27 00:00:00.000000000 Z
12
+ date: 2018-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport