ansible_tower_client 0.20.2 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1feb80243276376bf97dde6659e9120ee50077d2c07f91daeb006ed63f95262f
4
- data.tar.gz: 27dabdade9e2e6483cd8f7d46e575feaeef64ebbc4069d7009d68c9e7d5420d2
3
+ metadata.gz: 6c69651105f775ced783576fea3e67136e99706f69e977ea2cc3c552c982c09c
4
+ data.tar.gz: ecb65f36c686dd4e9729823a6d752df2aba5f1d25d53e14d579390734a99aebf
5
5
  SHA512:
6
- metadata.gz: a1cc2ee34f52c11605806b2a99f8012aba5203364a8ca485d66e7ce8b78fc8ec741b1703e6bbb5465814586ecc2725ca829cd9c18113f9f152410882fb9c5ab4
7
- data.tar.gz: 1e4459f11c5e1443b414e88b3f94c82d5975e8d0febb9d9e65c55648d4cc1971531e050ca7d173f2e4eb9a16ab8b82d81babfd1527b2ee913f6b556abf68eac2
6
+ metadata.gz: 8cfd7f0ddc93a0d0bbbe75ca11737b4687667d6e8d9ab472208c873d8d8483f31fadd4865e6ec9ab40ac01955850d4cf94f4cd24e35961d35341f48b73a5f644
7
+ data.tar.gz: 3fdec2bed48fbb01b38e521db077509cee7907a4e8e4142f13ceddac874ae1dddd62e8de219618bfb760345d6bfec81798def2c1263e34ad175cc169d70ac952
@@ -5,6 +5,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.21.0] - 2020-02-12
9
+ ### Added
10
+ - Add support for connection headers and proxy [(#134)](https://github.com/ansible/ansible_tower_client_ruby/pull/134)
11
+ - Allow request options to be passed to Faraday [(#140)](https://github.com/ansible/ansible_tower_client_ruby/pull/140)
12
+ - Add usage documentation to the README [(#138)](https://github.com/ansible/ansible_tower_client_ruby/pull/138)
13
+
14
+ ### Fixed
15
+ - Fix issue where passing no options gives a NilError [(#136)](https://github.com/ansible/ansible_tower_client_ruby/pull/136)
16
+
17
+ ### Changed
18
+ - Extract MockApi responses into JSON files [(#137)](https://github.com/ansible/ansible_tower_client_ruby/pull/137)
19
+
8
20
  ## [0.20.2] - 2019-08-19
9
21
  ### Fixed
10
22
  - Ensure #vault_password is never nil [(#132)](https://github.com/ansible/ansible_tower_client_ruby/pull/132)
@@ -126,7 +138,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
126
138
  ### Fixed
127
139
  - Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
128
140
 
129
- [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.2...master
141
+ [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.21.0...master
142
+ [0.21.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.2...v0.21.0
130
143
  [0.20.2]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.1...v0.20.2
131
144
  [0.20.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.0...v0.20.1
132
145
  [0.20.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.1...v0.20.0
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
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
8
 
6
- # Pull in a development Gemfile if one exists
7
- eval_gemfile('Gemfile.dev.rb') if File.exists?('Gemfile.dev.rb')
8
-
9
9
  # HACK: Rails 5 dropped support for Ruby < 2.2.2
10
10
  active_support_version = "< 5" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2.2")
11
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.
@@ -12,7 +12,7 @@ module AnsibleTowerClient
12
12
  end
13
13
 
14
14
  def config
15
- JSON.parse(get("config/").body)
15
+ JSON.parse(get("config").body)
16
16
  end
17
17
 
18
18
  def version
@@ -5,8 +5,9 @@ module AnsibleTowerClient
5
5
  attr_reader :connection
6
6
 
7
7
  def initialize(options = nil)
8
- raise "Credentials are required" unless options[:username] && options[:password]
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
- @connection = Faraday.new(options[:base_url], :ssl => {:verify => verify_ssl}) do |f|
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)
@@ -1,3 +1,3 @@
1
1
  module AnsibleTowerClient
2
- VERSION = "0.20.2".freeze
2
+ VERSION = "0.21.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.20.2
4
+ version: 0.21.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: 2019-08-19 00:00:00.000000000 Z
12
+ date: 2020-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -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
- rubyforge_project:
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