ansible_tower_client 0.19.1 → 0.20.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: d1a288ed349e5e1039eeb1679ac362a14dd04a29881dcba2fefe00d56ad38d37
4
- data.tar.gz: '08b1c643d52ef8a8a6469337659a16422430e45e121be392a194df5c3ba28512'
3
+ metadata.gz: '08f27f29feac6a32266e5c3f567a410d90caf9fb11cce3c3d7c079145784280e'
4
+ data.tar.gz: 9136eeeab2dc3dbb0ac23dc72905e8e8ee19a0c73a1031693d00519671e7331c
5
5
  SHA512:
6
- metadata.gz: 8420eccf49a31b14a5aa8fa4c0979e54b54f769aa33986838245cb55d10f7294857a71f7cf0e5d02d070fc6f08bb41bd1b081e9c4070bd287c2350c99eaf54ad
7
- data.tar.gz: b4c976cdf183e43c7769642105e6c7695f819d162fc080c93c313a2190b9eac2070df8048815c8cb50db259f7b63fac9e47e29bc116fb51a6c6d94ef041dad96
6
+ metadata.gz: 49034faefae5375f52d9e45afde8173bfb15430ad1e0ff0bc29b82a6e79ce1c69ea5a557a7fed788fcfecfcaa43822214fec8d088062ee7d0e4cf67c9465885e
7
+ data.tar.gz: 8f31190deca0df56e1d21429a39e9eae367322d714a912f8a1bbf18deb9daba1b88eb597b790e10c878662e26fd37dbf8cc1c84242b17bb16656d138d4b64030
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.3.1"
4
- - "2.4.1"
3
+ - "2.4.5"
4
+ - "2.5.3"
5
5
  sudo: false
6
6
  cache: bundler
7
- before_install: gem install bundler -v 1.10.3
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.20.0] - 2019-05-22
9
+ ### Added
10
+ - Added support for v2 API credential objects [(#123)](https://github.com/ansible/ansible_tower_client_ruby/pull/123)
11
+
8
12
  ## [0.19.1] - 2019-03-25
9
13
  ### Fixed
10
14
  - Avoid redundant redirects [(#124)](https://github.com/ansible/ansible_tower_client_ruby/pull/124) [(#127)](https://github.com/ansible/ansible_tower_client_ruby/pull/127)
@@ -114,7 +118,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
114
118
  ### Fixed
115
119
  - Adjusted project_spec to test on a Project [(#63)](https://github.com/ansible/ansible_tower_client_ruby/pull/63)
116
120
 
117
- [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.1...master
121
+ [Unreleased]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.20.0...master
122
+ [0.20.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.1...v0.20.0
118
123
  [0.19.1]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.19.0...v0.19.1
119
124
  [0.19.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.18.0...v0.19.0
120
125
  [0.18.0]: https://github.com/ansible/ansible_tower_client_ruby/compare/v0.17.0...v0.18.0
@@ -1,7 +1,5 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'ansible_tower_client/version'
2
+ require_relative 'lib/ansible_tower_client/version'
5
3
 
6
4
  Gem::Specification.new do |spec|
7
5
  spec.name = "ansible_tower_client"
@@ -17,15 +15,13 @@ Gem::Specification.new do |spec|
17
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
16
  spec.bindir = "exe"
19
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
18
 
22
19
  spec.add_runtime_dependency "activesupport"
23
20
  spec.add_runtime_dependency "faraday"
24
21
  spec.add_runtime_dependency "faraday_middleware"
25
22
  spec.add_runtime_dependency "more_core_extensions", "~> 3.0"
26
23
 
27
- spec.add_development_dependency "bundler", "~> 1.10"
28
- spec.add_development_dependency "factory_girl"
29
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "factory_bot", "~> 4.11"
25
+ spec.add_development_dependency "rake", "~> 12.3"
30
26
  spec.add_development_dependency "rspec"
31
27
  end
@@ -14,6 +14,7 @@ require "ansible_tower_client/collection"
14
14
  require "ansible_tower_client/base_models/activity_stream"
15
15
  require "ansible_tower_client/base_models/ad_hoc_command"
16
16
  require "ansible_tower_client/base_models/credential"
17
+ require "ansible_tower_client/base_models/credential_type"
17
18
  require "ansible_tower_client/base_models/group"
18
19
  require "ansible_tower_client/base_models/host"
19
20
  require "ansible_tower_client/base_models/inventory"
@@ -35,6 +35,10 @@ module AnsibleTowerClient
35
35
  Collection.new(self, credential_class)
36
36
  end
37
37
 
38
+ def credential_types
39
+ Collection.new(self, credential_type_class)
40
+ end
41
+
38
42
  def groups
39
43
  Collection.new(self, group_class)
40
44
  end
@@ -149,6 +153,10 @@ module AnsibleTowerClient
149
153
  @credential_class ||= AnsibleTowerClient::Credential
150
154
  end
151
155
 
156
+ def credential_type_class
157
+ @credential_type_class ||= AnsibleTowerClient::CredentialType
158
+ end
159
+
152
160
  def group_class
153
161
  @group_class ||= AnsibleTowerClient::Group
154
162
  end
@@ -1,7 +1,45 @@
1
1
  module AnsibleTowerClient
2
2
  class Credential < BaseModel
3
3
  def override_raw_attributes
4
- { :organization => :organization_id }
4
+ {
5
+ :organization => :organization_id,
6
+ :credential_type => :credential_type_id,
7
+ }
8
+ end
9
+
10
+ # https://github.com/ansible/awx/blob/1328fb80a02ef4e37bc021eb07d4be041a41f937/awx/main/models/credential/__init__.py#L76-L90
11
+ KIND_CHOICES = {
12
+ 'ssh' => 'Machine',
13
+ 'net' => 'Network',
14
+ 'scm' => 'Source Control',
15
+ 'aws' => 'Amazon Web Services',
16
+ 'vmware' => 'VMware vCenter',
17
+ 'satellite6' => 'Red Hat Satellite 6',
18
+ 'cloudforms' => 'Red Hat CloudForms',
19
+ 'gce' => 'Google Compute Engine',
20
+ 'azure_rm' => 'Microsoft Azure Resource Manager',
21
+ 'openstack' => 'OpenStack',
22
+ 'rhv' => 'Red Hat Virtualization',
23
+ 'insights' => 'Insights',
24
+ 'tower' => 'Ansible Tower',
25
+ }.invert
26
+ KIND_CHOICES.default = 'cloud'
27
+ KIND_CHOICES.freeze
28
+
29
+ # https://github.com/ansible/awx/blob/1328fb80a02ef4e37bc021eb07d4be041a41f937/awx/main/models/credential/__init__.py#L301
30
+ def kind
31
+ @data['kind'] ||= begin
32
+ kind = credential_type.kind
33
+ kind == 'cloud' ? KIND_CHOICES[credential_type.name] : kind
34
+ end.to_s
35
+ end
36
+
37
+ def credential_type
38
+ @credential_type ||= api.credential_types.find(credential_type_id)
39
+ end
40
+
41
+ def vault_password
42
+ @data['vault_password'] ||= inputs.vault_password.to_s
5
43
  end
6
44
  end
7
45
  end
@@ -0,0 +1,4 @@
1
+ module AnsibleTowerClient
2
+ class CredentialType < BaseModel
3
+ end
4
+ end
@@ -19,8 +19,25 @@ module AnsibleTowerClient
19
19
  end
20
20
 
21
21
  def last_update
22
- return if related['last_update'].blank?
23
- api.project_updates.find(related['last_update'])
22
+ return @last_update if defined? @last_update
23
+ return @last_update = nil unless related.raw_hash.key?('last_update')
24
+ return @last_update = nil if (update_id = related.last_update).blank?
25
+
26
+ if !numberish?(update_id)
27
+ if raw_hash.key?('summary_fields') && summary_fields.raw_hash.key?('last_update')
28
+ update_id = summary_fields.last_update.id
29
+ else
30
+ /\/(?'update_id'\d+)\/?\z/ =~ update_id
31
+ end
32
+ end
33
+
34
+ @last_update = update_id && api.project_updates.find(update_id)
35
+ end
36
+
37
+ private
38
+
39
+ def numberish?(value)
40
+ value.kind_of?(Numeric) || value.to_s =~ /\A\d+\z/
24
41
  end
25
42
  end
26
43
  end
@@ -1,3 +1,3 @@
1
1
  module AnsibleTowerClient
2
- VERSION = "0.19.1".freeze
2
+ VERSION = "0.20.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.19.1
4
+ version: 0.20.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-03-25 00:00:00.000000000 Z
12
+ date: 2019-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -68,47 +68,33 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '3.0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: bundler
71
+ name: factory_bot
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.10'
76
+ version: '4.11'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '1.10'
84
- - !ruby/object:Gem::Dependency
85
- name: factory_girl
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
83
+ version: '4.11'
98
84
  - !ruby/object:Gem::Dependency
99
85
  name: rake
100
86
  requirement: !ruby/object:Gem::Requirement
101
87
  requirements:
102
88
  - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: '10.0'
90
+ version: '12.3'
105
91
  type: :development
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - "~>"
110
96
  - !ruby/object:Gem::Version
111
- version: '10.0'
97
+ version: '12.3'
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: rspec
114
100
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +136,7 @@ files:
150
136
  - lib/ansible_tower_client/base_models/activity_stream.rb
151
137
  - lib/ansible_tower_client/base_models/ad_hoc_command.rb
152
138
  - lib/ansible_tower_client/base_models/credential.rb
139
+ - lib/ansible_tower_client/base_models/credential_type.rb
153
140
  - lib/ansible_tower_client/base_models/group.rb
154
141
  - lib/ansible_tower_client/base_models/host.rb
155
142
  - lib/ansible_tower_client/base_models/inventory.rb
@@ -197,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
184
  version: '0'
198
185
  requirements: []
199
186
  rubyforge_project:
200
- rubygems_version: 2.7.6
187
+ rubygems_version: 2.7.6.2
201
188
  signing_key:
202
189
  specification_version: 4
203
190
  summary: Ansible Tower REST API wrapper gem