ansible_tower_client 0.20.1 → 0.21.3
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 +4 -4
- data/CHANGELOG.md +34 -1
- data/Gemfile +3 -7
- data/README.md +30 -0
- data/ansible_tower_client.gemspec +1 -1
- data/lib/ansible_tower_client/api.rb +4 -1
- data/lib/ansible_tower_client/base_models/credential.rb +4 -1
- data/lib/ansible_tower_client/connection.rb +9 -2
- data/lib/ansible_tower_client/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a36902a09e1b64b2dc5f02ff68abaed21a14c679977ecfe6b4d295ef89b2750
|
4
|
+
data.tar.gz: 718a142b64f0c6b832430e5af4bd993aba979864d5c6d0dcd344f7496c0d943d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977e42aa1aede8343a1244e2e645dbeea23877c6c10f85f80d72cf9bca6019ef15318a5c4daca4f1dc8f874b60f5b62c896b028bacd75a1fe79d7630c334d9ed
|
7
|
+
data.tar.gz: aa83aabdaacfe8e3d194a591a80885262dce295884730ed75e05cde9e60e7e40d22d7baefcfb15fce5a2ff4f992d35cd43458cbd3b3660a447061c436d7ec3f3
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,34 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.21.3] - 2020-07-09
|
9
|
+
### Fixed
|
10
|
+
- Update dependency on more_core_extensions [(#145)](https://github.com/ansible/ansible_tower_client_ruby/pull/145)
|
11
|
+
|
12
|
+
## [0.21.2] - 2020-06-09
|
13
|
+
### Fixed
|
14
|
+
- Return AnsibleTowerClient::ConnectionError if not able to parse response in #verify_credentials [(#144)](https://github.com/ansible/ansible_tower_client_ruby/pull/144)
|
15
|
+
|
16
|
+
## [0.21.1] - 2020-02-17
|
17
|
+
### Fixed
|
18
|
+
- Revert removal of trailing "/" on get of "config" [(#141)](https://github.com/ansible/ansible_tower_client_ruby/pull/141)
|
19
|
+
|
20
|
+
## [0.21.0] - 2020-02-12
|
21
|
+
### Added
|
22
|
+
- Add support for connection headers and proxy [(#134)](https://github.com/ansible/ansible_tower_client_ruby/pull/134)
|
23
|
+
- Allow request options to be passed to Faraday [(#140)](https://github.com/ansible/ansible_tower_client_ruby/pull/140)
|
24
|
+
- Add usage documentation to the README [(#138)](https://github.com/ansible/ansible_tower_client_ruby/pull/138)
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- Fix issue where passing no options gives a NilError [(#136)](https://github.com/ansible/ansible_tower_client_ruby/pull/136)
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
- Extract MockApi responses into JSON files [(#137)](https://github.com/ansible/ansible_tower_client_ruby/pull/137)
|
31
|
+
|
32
|
+
## [0.20.2] - 2019-08-19
|
33
|
+
### Fixed
|
34
|
+
- Ensure #vault_password is never nil [(#132)](https://github.com/ansible/ansible_tower_client_ruby/pull/132)
|
35
|
+
|
8
36
|
## [0.20.1] - 2019-06-20
|
9
37
|
### Fixed
|
10
38
|
- Only attempt to find a related job if there is a reference to one [(#131)](https://github.com/ansible/ansible_tower_client_ruby/pull/131)
|
@@ -122,7 +150,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
122
150
|
### Fixed
|
123
151
|
- Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
|
124
152
|
|
125
|
-
[Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.
|
153
|
+
[Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.21.3...master
|
154
|
+
[0.21.3]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.21.2...v0.21.3
|
155
|
+
[0.21.2]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.21.1...v0.21.2
|
156
|
+
[0.21.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.21.0...v0.21.1
|
157
|
+
[0.21.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.2...v0.21.0
|
158
|
+
[0.20.2]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.1...v0.20.2
|
126
159
|
[0.20.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.0...v0.20.1
|
127
160
|
[0.20.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.1...v0.20.0
|
128
161
|
[0.19.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.0...v0.19.1
|
data/Gemfile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
plugin "bundler-inject", "~> 1.1"
|
4
|
+
require File.join(Bundler::Plugin.index.load_paths("bundler-inject")[0], "bundler-inject") rescue nil
|
5
|
+
|
3
6
|
# Specify your gem's dependencies in ansible_tower_client.gemspec
|
4
7
|
gemspec
|
5
|
-
|
6
|
-
# Pull in a development Gemfile if one exists
|
7
|
-
eval_gemfile('Gemfile.dev.rb') if File.exists?('Gemfile.dev.rb')
|
8
|
-
|
9
|
-
# HACK: Rails 5 dropped support for Ruby < 2.2.2
|
10
|
-
active_support_version = "< 5" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2.2")
|
11
|
-
gem "activesupport", active_support_version
|
data/README.md
CHANGED
@@ -23,6 +23,36 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
$ gem install ansible_tower_client
|
25
25
|
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'ansible_tower_client'
|
30
|
+
|
31
|
+
# Optionally set a global logger
|
32
|
+
AnsibleTowerClient.logger = Logger.new(STDOUT)
|
33
|
+
|
34
|
+
# Create a connection
|
35
|
+
conn = AnsibleTowerClient::Connection.new(
|
36
|
+
:base_url => "https://awx.example.com/",
|
37
|
+
:username => "admin",
|
38
|
+
:password => "pa$$w0rd!",
|
39
|
+
:verify_ssl => OpenSSL::SSL::VERIFY_PEER # Optional: an OpenSSL::SSL::VERIFY_* constant
|
40
|
+
)
|
41
|
+
|
42
|
+
# Query the config
|
43
|
+
conn.api.config
|
44
|
+
# => {"eula"=>"text"
|
45
|
+
# "version"=>"3.2.2",
|
46
|
+
# "project_base_dir"=>"/var/lib/awx/projects",
|
47
|
+
# "ansible_version"=>"2.4.1.0",
|
48
|
+
# ...}
|
49
|
+
|
50
|
+
# Query a collection
|
51
|
+
conn.api.job_templates.all
|
52
|
+
# => [<AnsibleTowerClient::JobTemplate id=580, type="job_template", url="/api/v1/job_templates/580/", name="ems_refresh_spec-job_template", description="EmsRefreshSpec JobTemplate", ...>
|
53
|
+
# <AnsibleTowerClient::JobTemplate id=585, type="job_template", url="/api/v1/job_templates/585/", name="ems_refresh_spec-job_template2", description="EmsRefreshSpec JobTemplate", ...>]
|
54
|
+
```
|
55
|
+
|
26
56
|
## Development
|
27
57
|
|
28
58
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_runtime_dependency "activesupport"
|
20
20
|
spec.add_runtime_dependency "faraday"
|
21
21
|
spec.add_runtime_dependency "faraday_middleware"
|
22
|
-
spec.add_runtime_dependency "more_core_extensions", "~>
|
22
|
+
spec.add_runtime_dependency "more_core_extensions", "~> 4.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "factory_bot", "~> 4.11"
|
25
25
|
spec.add_development_dependency "rake", "~> 12.3"
|
@@ -20,7 +20,10 @@ module AnsibleTowerClient
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def verify_credentials
|
23
|
-
|
23
|
+
results = get("me/").body
|
24
|
+
JSON.parse(results).fetch_path("results", 0, "username")
|
25
|
+
rescue JSON::ParserError
|
26
|
+
raise AnsibleTowerClient::ConnectionError, "unexpected response"
|
24
27
|
end
|
25
28
|
|
26
29
|
def activity_stream
|
@@ -39,7 +39,10 @@ module AnsibleTowerClient
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def vault_password
|
42
|
-
@data['vault_password'] ||=
|
42
|
+
@data['vault_password'] ||= begin
|
43
|
+
has_vault_password = respond_to?(:inputs) && inputs.respond_to?(:vault_password)
|
44
|
+
(inputs.vault_password if has_vault_password).to_s
|
45
|
+
end
|
43
46
|
end
|
44
47
|
end
|
45
48
|
end
|
@@ -5,8 +5,9 @@ module AnsibleTowerClient
|
|
5
5
|
attr_reader :connection
|
6
6
|
|
7
7
|
def initialize(options = nil)
|
8
|
-
raise "
|
8
|
+
raise ":username and :password are required" if options.nil? || !options[:username] || !options[:password]
|
9
9
|
raise ":base_url is required" unless options[:base_url]
|
10
|
+
|
10
11
|
logger = options[:logger] || AnsibleTowerClient.logger
|
11
12
|
verify_ssl = options[:verify_ssl] || OpenSSL::SSL::VERIFY_PEER
|
12
13
|
verify_ssl = verify_ssl == OpenSSL::SSL::VERIFY_NONE ? false : true
|
@@ -15,7 +16,13 @@ module AnsibleTowerClient
|
|
15
16
|
require 'faraday_middleware'
|
16
17
|
require 'ansible_tower_client/middleware/raise_tower_error'
|
17
18
|
Faraday::Response.register_middleware :raise_tower_error => -> { Middleware::RaiseTowerError }
|
18
|
-
|
19
|
+
|
20
|
+
connection_opts = { :ssl => {:verify => verify_ssl} }
|
21
|
+
connection_opts[:proxy] = options[:proxy] if options[:proxy].present?
|
22
|
+
connection_opts[:headers] = options[:headers] if options[:headers].present?
|
23
|
+
connection_opts[:request] = options[:request] if options[:request].present?
|
24
|
+
|
25
|
+
@connection = Faraday.new(options[:base_url], connection_opts) do |f|
|
19
26
|
f.use(FaradayMiddleware::EncodeJson)
|
20
27
|
f.use(FaradayMiddleware::FollowRedirects, :limit => 3, :standards_compliant => true)
|
21
28
|
f.request(:url_encoded)
|
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.21.3
|
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:
|
12
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '4.0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '4.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: factory_bot
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,8 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
|
-
|
187
|
-
rubygems_version: 2.7.6.2
|
186
|
+
rubygems_version: 3.0.6
|
188
187
|
signing_key:
|
189
188
|
specification_version: 4
|
190
189
|
summary: Ansible Tower REST API wrapper gem
|