ansible_tower_client 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/ansible_tower_client/api.rb +10 -0
- data/lib/ansible_tower_client/base_model.rb +4 -0
- data/lib/ansible_tower_client/base_models/ad_hoc_command.rb +0 -4
- data/lib/ansible_tower_client/base_models/credential.rb +0 -3
- data/lib/ansible_tower_client/base_models/group.rb +0 -4
- data/lib/ansible_tower_client/base_models/host.rb +0 -4
- data/lib/ansible_tower_client/base_models/inventory.rb +0 -4
- data/lib/ansible_tower_client/base_models/inventory_source.rb +0 -4
- data/lib/ansible_tower_client/base_models/inventory_update.rb +0 -3
- data/lib/ansible_tower_client/base_models/job.rb +0 -4
- data/lib/ansible_tower_client/base_models/job_template.rb +1 -4
- data/lib/ansible_tower_client/base_models/project.rb +2 -2
- data/lib/ansible_tower_client/collection.rb +10 -5
- data/lib/ansible_tower_client/exception.rb +2 -1
- data/lib/ansible_tower_client/middleware/raise_tower_error.rb +2 -0
- data/lib/ansible_tower_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f98b1405077eafacead17dc58b4ee20535e263dd
|
4
|
+
data.tar.gz: 9a1043e6af5bd81554f5c1f499b2b0a5b5bd7265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7ed7d56555c0b60b8590d5455eba86aa53ca65c083b3ebd331acd1c627dbe99b38f06a99782d8e9d7c7cb9b9f16cd103fca955bf3996b6cc626d6d497a3f19e
|
7
|
+
data.tar.gz: 807c37a2d965f77c1f9ddbe0cec24e7c26ba2f5c53f48b9b37d4b710e1bdbc95747c59425117a62731474952c32399c1dbacd8f28ab778a96fb3a2de9f048c5e
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
+
|
6
|
+
## [0.6.0] - 2017-02-02
|
7
|
+
### Added
|
8
|
+
- Refactor `#endpoint` [(#64)](https://github.com/ansible/ansible_tower_client_ruby/pull/64)
|
9
|
+
- Expose playbooks off of projects [(#62)](https://github.com/ansible/ansible_tower_client_ruby/pull/62)
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Allow for alternative resource paths [(#66)](https://github.com/ansible/ansible_tower_client_ruby/pull/66)
|
13
|
+
- Raise UnlicensedFeatureError when we receive HTTP 402 [(#65)](https://github.com/ansible/ansible_tower_client_ruby/pull/65)
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
|
@@ -69,6 +69,8 @@ module AnsibleTowerClient
|
|
69
69
|
|
70
70
|
def method_missing(method_name, *args, &block)
|
71
71
|
if instance.respond_to?(method_name)
|
72
|
+
path = build_path_to_resource(args.shift)
|
73
|
+
args.unshift(path)
|
72
74
|
logger.debug { "#{self.class.name} Sending <#{method_name}> with <#{args.inspect}>" }
|
73
75
|
instance.send(method_name, *args, &block).tap do |response|
|
74
76
|
logger.debug { "#{self.class.name} Response:\n#{JSON.parse(response.body).pretty_inspect}" }
|
@@ -143,5 +145,13 @@ module AnsibleTowerClient
|
|
143
145
|
def project_class
|
144
146
|
@project_class ||= AnsibleTowerClient::Project
|
145
147
|
end
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
def build_path_to_resource(original)
|
152
|
+
return original unless %r{\/?api\/v1\/(.*)} =~ original
|
153
|
+
return original if instance.url_prefix.path == "/"
|
154
|
+
File.join(instance.url_prefix.path, Regexp.last_match[1])
|
155
|
+
end
|
146
156
|
end
|
147
157
|
end
|
@@ -6,6 +6,10 @@ module AnsibleTowerClient
|
|
6
6
|
superclass == AnsibleTowerClient::BaseModel ? self : superclass.base_class
|
7
7
|
end
|
8
8
|
|
9
|
+
def self.endpoint
|
10
|
+
base_class.to_s.split(/::/)[1].tableize.to_s.freeze
|
11
|
+
end
|
12
|
+
|
9
13
|
# Constructs and returns a new JSON wrapper class. Pass in a plain
|
10
14
|
# JSON string and it will automatically give you accessor methods
|
11
15
|
# that make it behave like a typical Ruby object. You may also pass
|
@@ -11,6 +11,7 @@ module AnsibleTowerClient
|
|
11
11
|
spec_url = related['survey_spec']
|
12
12
|
return nil unless spec_url
|
13
13
|
api.get(spec_url).body
|
14
|
+
rescue AnsibleTowerClient::UnlicensedFeatureError
|
14
15
|
end
|
15
16
|
|
16
17
|
def survey_spec_hash
|
@@ -20,9 +21,5 @@ module AnsibleTowerClient
|
|
20
21
|
def extra_vars_hash
|
21
22
|
extra_vars.empty? ? {} : hashify(:extra_vars)
|
22
23
|
end
|
23
|
-
|
24
|
-
def self.endpoint
|
25
|
-
"job_templates".freeze
|
26
|
-
end
|
27
24
|
end
|
28
25
|
end
|
@@ -47,17 +47,22 @@ module AnsibleTowerClient
|
|
47
47
|
def fetch_more_results(next_page, get_options)
|
48
48
|
return if next_page.nil?
|
49
49
|
body = parse_response(api.get(next_page, get_options))
|
50
|
-
parse_result_set(body
|
51
|
-
|
52
|
-
body["next"]
|
50
|
+
parse_result_set(body)
|
53
51
|
end
|
54
52
|
|
55
53
|
def parse_response(response)
|
56
54
|
JSON.parse(response.body)
|
57
55
|
end
|
58
56
|
|
59
|
-
def parse_result_set(
|
60
|
-
|
57
|
+
def parse_result_set(body)
|
58
|
+
case body.class.name
|
59
|
+
when "Array" then
|
60
|
+
@collection = body
|
61
|
+
nil
|
62
|
+
when "Hash" then
|
63
|
+
body["results"].each { |result| @collection << build_object(result) }
|
64
|
+
body["next"]
|
65
|
+
end
|
61
66
|
end
|
62
67
|
|
63
68
|
def build_object(result)
|
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.
|
4
|
+
version: 0.6.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: 2017-
|
12
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- ".rubocop.yml"
|
137
137
|
- ".rubocop_local.yml"
|
138
138
|
- ".travis.yml"
|
139
|
+
- CHANGELOG.md
|
139
140
|
- Gemfile
|
140
141
|
- LICENSE.txt
|
141
142
|
- README.md
|