hammer_cli_katello 0.24.2 → 0.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f913438c207c69774eadb286a20e8cb249c77eef5c64fec2b431d3d5bdfe11d
4
- data.tar.gz: b00a4f7143e13ca251ee5ba533277c786c887f9211ed1273e35124f6006d83a5
3
+ metadata.gz: 3966349f8fac0df348af893168e4eb594d765834eeef7e973fe465cf78755331
4
+ data.tar.gz: 51541df551c787282da8367983c6a29543b529e20192c098169b5d0d1c1bc203
5
5
  SHA512:
6
- metadata.gz: d555ffa3fe7daf61efc108c218646aa42e8923686b3e28a23fbf137354c2a7645de12ca0ab44ccaab524ae00690a143a783f0668fa8b998be8e12b17714f0400
7
- data.tar.gz: ef7a75b53d2e1ed73f64156b77935e634042394b15edad9e4d28ed23350496d089359d4dc1b2a037a7aef42e48ca58cbada276e8e7fc03fd2391f68361f5677e
6
+ metadata.gz: 5ed98c8abdee101d12324fdc9605c568f9adff0e3dae32d59941ac1d5ec8ebfa2d50826297d7826cff39ca2fb9b47707b356eb5e09618b2dc971bd5852cc0c50
7
+ data.tar.gz: 1c4f11a142861744f6f4ee0c618927d460c84e581ece723d76dc18ea44b90949b8afd1aa53747aa5d3307311814ece3d6cdf8f2ba94cbb019d7f63f395b39d16
@@ -117,6 +117,7 @@ module HammerCLIKatello
117
117
  end
118
118
  end
119
119
 
120
+ # rubocop:disable Style/EmptyElse
120
121
  def content_view_version_id(options)
121
122
  key_id = HammerCLI.option_accessor_name("id")
122
123
  key_content_view_id = HammerCLI.option_accessor_name("content_view_id")
@@ -129,6 +130,8 @@ module HammerCLIKatello
129
130
  results = find_resources(:content_view_versions, options)
130
131
  options[from_environment_id] ||= from_lifecycle_environment_id(options)
131
132
 
133
+ return pick_result(results, @api.resource(:content_view_versions))['id'] if results.size == 1
134
+
132
135
  if results.size > 1 && options[from_environment_id]
133
136
  results_in_from_environment = results.select do |version|
134
137
  member_of_environment_ids = version['environments'].map { |env| env['id'].to_s }
@@ -137,9 +140,10 @@ module HammerCLIKatello
137
140
  results_in_from_environment
138
141
  .sort { |a, b| a['version'].to_f <=> b['version'].to_f }.last['id']
139
142
  else
140
- pick_result(results, @api.resource(:content_view_versions))['id']
143
+ nil
141
144
  end
142
145
  end
146
+ # rubocop:enable Style/EmptyElse
143
147
 
144
148
  private
145
149
 
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('0.24.2')
3
+ @version ||= Gem::Version.new('0.24.3')
4
4
  end
5
5
  end
@@ -31,4 +31,34 @@ ID | DESTINATION SERVER | PATH | CONTENT VIEW VERSION | CONTENT VIEW VERSION ID
31
31
  result = run_cmd(%w(content-export list))
32
32
  assert_cmd(expected_result, result)
33
33
  end
34
+
35
+ it 'works with content-view-id only' do
36
+ api_expects(:content_view_versions, :index).returns(empty_response)
37
+
38
+ ex = api_expects(:content_exports, :index)
39
+
40
+ ex.returns(empty_response)
41
+ # rubocop:disable LineLength
42
+ expected_result = success_result('---|--------------------|------|----------------------|-------------------------|------------|-----------
43
+ ID | DESTINATION SERVER | PATH | CONTENT VIEW VERSION | CONTENT VIEW VERSION ID | CREATED AT | UPDATED AT
44
+ ---|--------------------|------|----------------------|-------------------------|------------|-----------
45
+ ')
46
+ # rubocop:enable LineLength
47
+ result = run_cmd(%w(content-export list --content-view-id=1))
48
+ assert_cmd(expected_result, result)
49
+ end
50
+
51
+ it 'works with content-view-version-id only' do
52
+ ex = api_expects(:content_exports, :index)
53
+
54
+ ex.returns(empty_response)
55
+ # rubocop:disable LineLength
56
+ expected_result = success_result('---|--------------------|------|----------------------|-------------------------|------------|-----------
57
+ ID | DESTINATION SERVER | PATH | CONTENT VIEW VERSION | CONTENT VIEW VERSION ID | CREATED AT | UPDATED AT
58
+ ---|--------------------|------|----------------------|-------------------------|------------|-----------
59
+ ')
60
+ # rubocop:enable LineLength
61
+ result = run_cmd(%w(content-export list --content-view-version-id=1))
62
+ assert_cmd(expected_result, result)
63
+ end
34
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.2
4
+ version: 0.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -35,7 +35,7 @@ authors:
35
35
  autorequire:
36
36
  bindir: bin
37
37
  cert_chain: []
38
- date: 2021-01-05 00:00:00.000000000 Z
38
+ date: 2021-03-05 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: hammer_cli_foreman