hammer_cli_katello 0.0.17 → 0.0.18

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDlhYzMxN2Q0NGM4ZGVhNjE0MjM1ZjRiNzFlY2Q2ZDFhZDhkM2JmYQ==
4
+ NDg1YWQ5ZjNjNDBhZWEzNjYzYmNhYjEzNmUxYmM4MTQ2MmExODhmMA==
5
5
  data.tar.gz: !binary |-
6
- NWJmOGUzN2UyODNiZmRiYmE4MTMzZTdmMjE5Yjc1Yzk2YmZjMjU4MQ==
6
+ NTQ0ZGIxYTVlODUzNjk2ZTMzNTViY2M2ZWFiNjYxODE0YmUwZjdhZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzIxODRkM2M3Mjg0YmU4MjU2NWM1N2NjMzA5MTliYjUxZGZmMzBjYmE1ODRk
10
- MjU1OWRkNzBjOWFmODdlOTE5ZjUwZWRjYjFhNjE2ZWMxYTk5NmJkNzFjNDdk
11
- MWMyNjVlNGZhZWI4OTQyMGIzMGFjNzUyODljNzU1N2YxNWI4Y2Q=
9
+ MTRlM2I3NDkyMThjMjI4YjljN2Q5MGYwZjlkZDBlMDc5YjgzY2UxMDQ3NTMy
10
+ MGQ4MDAyOGJiNDFkOGJkYWU1MzBkYjI3OWQ1MmQ3ODAzZDZkYTljYmM2MjM3
11
+ ZDI0MTE1NWExMGY4N2IwOGQ0ZjI1NjZiYzEwMTA5M2ZlMDMyOTg=
12
12
  data.tar.gz: !binary |-
13
- NjgxYWM3ZTNiODE2NjUwNmQ5NTkyNGFmYjU4NzUwYTFjYzI2ZGUzYTBiNTdi
14
- ZThjZWUwZTk5MDZjZGRlNjUwZWEzOGExNjVhNjdlZDBjYjMxYzQwNGQ5NDYz
15
- YzQwYWUzNDhjNmUwZGFjNWRkMTkzMWE0MGI0Y2JjMGY2NDkwMTI=
13
+ NTY4YjYxZjAxNzdlMzA3YzU1Nzk2ZGYyOTdlYzBiY2MyMTMwOTk5YWFkZDli
14
+ MzI1OTRlN2Q5MzMzMjVjOWQxNDJkODc3YmE2NjhjYjZjMDA4ZDJhYzI1MDVj
15
+ YmUwNDhmY2I3ODYxMjExNmZmNjU5ODFiOGY3NzUzOTExY2I4MTk=
@@ -4,6 +4,7 @@ module HammerCLIKatello
4
4
  desc "Manage errata on your content hosts"
5
5
 
6
6
  class ApplyCommand < HammerCLIKatello::SingleResourceCommand
7
+ include HammerCLIForemanTasks::Async
7
8
  resource :system_errata, :apply
8
9
  command_name "apply"
9
10
  success_message _("Errata applied successfully")
@@ -191,6 +191,7 @@ module HammerCLIKatello
191
191
 
192
192
  class RemoveContentViewVersionCommand < HammerCLIKatello::RemoveAssociatedCommand
193
193
  command_name 'remove-version'
194
+ desc _('Remove a version of a content view')
194
195
 
195
196
  def association_name(plural = false)
196
197
  plural ? "components" : "component"
@@ -78,6 +78,13 @@ module HammerCLIKatello
78
78
  _("Name of the target environment"), :attribute_name => :option_to_environment_name
79
79
  option "--to-lifecycle-environment-id", "TO_ENVIRONMENT_ID",
80
80
  _("Id of the target environment"), :attribute_name => :option_to_environment_id
81
+ option "--from-lifecycle-environment", "FROM_ENVIRONMENT_ID",
82
+ _("Environment name from where to promote its version from (if version is unknown)"),
83
+ :attribute_name => :option_from_environment_name
84
+ option "--from-lifecycle-environment-id", "FROM_ENVIRONMENT_ID",
85
+ _(["Id of the environment from where to promote its version ",
86
+ "from (if version is unknown)"].join),
87
+ :attribute_name => :option_from_environment_id
81
88
 
82
89
  def environment_search_options
83
90
  {
@@ -61,6 +61,7 @@ module HammerCLIKatello
61
61
  key_id = HammerCLI.option_accessor_name("id")
62
62
  key_environment_id = HammerCLI.option_accessor_name("environment_id")
63
63
  key_content_view_id = HammerCLI.option_accessor_name("content_view_id")
64
+ from_environment_id = HammerCLI.option_accessor_name("from_environment_id")
64
65
 
65
66
  return options[key_id] if options[key_id]
66
67
 
@@ -82,7 +83,19 @@ module HammerCLIKatello
82
83
  # content_view is not always required.
83
84
  end
84
85
 
85
- find_resource(:content_view_versions, options)['id']
86
+ results = find_resources(:content_view_versions, options)
87
+ options[from_environment_id] ||= from_lifecycle_environment_id(options)
88
+
89
+ if results.size > 1 && options[from_environment_id]
90
+ results_in_from_environment = results.select do |version|
91
+ member_of_environment_ids = version['environments'].map { |env| env['id'].to_s }
92
+ member_of_environment_ids.include? options[from_environment_id].to_s
93
+ end
94
+ results_in_from_environment
95
+ .sort { |a, b| a['version'].to_f <=> b['version'].to_f }.last['id']
96
+ else
97
+ pick_result(results, @api.resource(:content_view_versions))['id']
98
+ end
86
99
  end
87
100
 
88
101
  def create_repositories_search_options(options)
@@ -127,5 +140,19 @@ module HammerCLIKatello
127
140
  alias_method :create_search_options_without_katello_api, :create_search_options
128
141
  alias_method :create_search_options, :create_search_options_with_katello_api
129
142
 
143
+ private
144
+
145
+ def from_lifecycle_environment_id(options)
146
+ environment_id = HammerCLI.option_accessor_name("environment_id")
147
+ environment_name = HammerCLI.option_accessor_name("environment_name")
148
+ from_environment_id = HammerCLI.option_accessor_name("from_environment_id")
149
+ from_environment_name = HammerCLI.option_accessor_name("from_environment_name")
150
+ return nil if options[from_environment_id].nil? && options[from_environment_name].nil?
151
+ search_options = options.dup.tap do |opts|
152
+ opts[environment_name] = opts[from_environment_name]
153
+ opts[environment_id] = opts[from_environment_id]
154
+ end
155
+ lifecycle_environment_id(scoped_options("environment", search_options))
156
+ end
130
157
  end
131
158
  end
@@ -9,6 +9,7 @@ module HammerCLIKatello
9
9
  field :name, _("Name")
10
10
  field :sync_date, _("Start Date"), Fields::Date
11
11
  field :interval, _("Interval")
12
+ field :enabled, _("Enabled"), Fields::Boolean
12
13
  end
13
14
 
14
15
  build_options
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('0.0.17')
3
+ @version ||= Gem::Version.new('0.0.18')
4
4
  end
5
5
  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.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -23,7 +23,7 @@ authors:
23
23
  autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
- date: 2015-08-06 00:00:00.000000000 Z
26
+ date: 2015-09-23 00:00:00.000000000 Z
27
27
  dependencies:
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: hammer_cli_foreman
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 0.1.3
35
35
  - - <
36
36
  - !ruby/object:Gem::Version
37
- version: 0.4.0
37
+ version: 0.5.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 0.1.3
45
45
  - - <
46
46
  - !ruby/object:Gem::Version
47
- version: 0.4.0
47
+ version: 0.5.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: hammer_cli_foreman_tasks
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -292,3 +292,4 @@ signing_key:
292
292
  specification_version: 4
293
293
  summary: Katello commands for Hammer
294
294
  test_files: []
295
+ has_rdoc: