foreman_maintain 1.1.11 → 1.1.13

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: 05e00cf48a6dfb5684ac74e789ba933225d4c380a2b83d3e8df8cd607d537c8c
4
- data.tar.gz: c639bf3716c44df18b63125880f6521558ee754992e21eac73021e14e3ebfd5c
3
+ metadata.gz: 7bdeafd7ba1aab60a20589ff8cf9e35ef9baf40405df6151a1cf9ef63436b4a3
4
+ data.tar.gz: ea9b5aa95b3ac88fbc796d5a6882a5df6a746a79fcb8eb08e8f3f4a788fe9104
5
5
  SHA512:
6
- metadata.gz: 1899bd4d44b5ab634dfdd516c9db1e0cf4c45ced30b3de818bcbaa0b45bdedafe690a6e42eff5643e2b2e986c8289c792db34f3609161e33c9c773c27414cb93
7
- data.tar.gz: 68ee21c7b7e59cbc9a8d944fdebba54e82b72a5b67c4fbf5284f36caab4926f1223d0c5168d6303e624f4ed49b87c5167bbec6c222dc8d874a8b8fdb4d5af9ef
6
+ metadata.gz: 558b7b493fb0da9f6ec6d3290167db5df2e58844462a3c590d3e482e2646b4ae950b5858918e2ec0e6e89d424de92dae33c475d551243b5b39e29bc88cb694b9
7
+ data.tar.gz: 2e43180a586c591d161a56fd17f1d30fe16d3d46a26773e5c518d552a436d13f09cd28a4a1ffbbf0b6768193e7ed3d562f3fa83e8e8359e7eba0b3d1fd2e7220
@@ -34,10 +34,10 @@ class Features::SyncPlans < ForemanMaintain::Feature
34
34
  end
35
35
 
36
36
  def validate_sync_plan_ids(ids)
37
+ return [] if ids.empty?
38
+
37
39
  ids_condition = ids.map { |id| "'#{id}'" }.join(',')
38
- query = <<-SQL
39
- SELECT id FROM katello_sync_plans WHERE id IN (#{ids_condition})
40
- SQL
40
+ query = "SELECT id FROM katello_sync_plans WHERE id IN (#{ids_condition})"
41
41
  feature(:foreman_database).query(query).map { |r| r['id'].to_i }
42
42
  end
43
43
 
@@ -58,7 +58,9 @@ module ForemanMaintain::Scenarios
58
58
  manual_detection
59
59
  end
60
60
 
61
- def compose
61
+ def compose(pkgs_to_update)
62
+ ForemanMaintain.enable_maintenance_module
63
+
62
64
  if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
63
65
  pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
64
66
  yum_options = req_repos_to_update_pkgs.map do |id|
@@ -9,6 +9,24 @@ module ForemanMaintain::PackageManager
9
9
  true
10
10
  end
11
11
 
12
+ def module_enabled?(name)
13
+ _status, result = info(name)
14
+ result.match?(/Stream.+\[e\].+/)
15
+ end
16
+
17
+ def enable_module(name)
18
+ dnf_action('module enable', name, assumeyes: true)
19
+ end
20
+
21
+ def module_exists?(name)
22
+ status, _result = info(name)
23
+ status == 0
24
+ end
25
+
26
+ def info(name)
27
+ dnf_action('module info', name, with_status: true, assumeyes: true)
28
+ end
29
+
12
30
  private
13
31
 
14
32
  def dnf_action(action, packages, with_status: false, assumeyes: false)
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.1.11'.freeze
2
+ VERSION = '1.1.13'.freeze
3
3
  end
@@ -175,6 +175,9 @@ module ForemanMaintain
175
175
  package_name, command = pkg_and_cmd_name
176
176
 
177
177
  puts "Checking for new version of #{package_name}..."
178
+
179
+ enable_maintenance_module
180
+
178
181
  if ForemanMaintain.package_manager.update_available?(main_package_name)
179
182
  puts "\nUpdating #{package_name} package."
180
183
  ForemanMaintain.package_manager.update(main_package_name, :assumeyes => true)
@@ -185,6 +188,19 @@ module ForemanMaintain
185
188
  puts "Nothing to update, can't find new version of #{package_name}."
186
189
  end
187
190
 
191
+ def enable_maintenance_module
192
+ return unless el? && !el7?
193
+
194
+ maintenance_module = 'satellite-maintenance:el8'
195
+ package_manager = ForemanMaintain.package_manager
196
+
197
+ if package_manager.module_exists?(maintenance_module) &&
198
+ !package_manager.module_enabled?(maintenance_module)
199
+ puts "\nEnabling #{maintenance_module} module"
200
+ package_manager.enable_module(maintenance_module)
201
+ end
202
+ end
203
+
188
204
  def main_package_name
189
205
  'rubygem-foreman_maintain'
190
206
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
4
+ version: 1.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp