foreman_maintain 1.2.3 → 1.2.5

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: cdc12ecbef4e02dd8b77b3c4888623c13e418b7435a53f8dc1d280b9faf0b699
4
- data.tar.gz: 4d75194cf9184f68be21cbc55cba1def43d76eff4cfc1bc92a091b93662c3371
3
+ metadata.gz: f4f3a8ccaafca99807806029569f3f36ae2510fad72f8c4e38cc5151dc90b0f5
4
+ data.tar.gz: 37af7fa939b29079d404a1d6461f4425e53b35574a9a76829b7effcadf698443
5
5
  SHA512:
6
- metadata.gz: 26f3e34a2670e7b92ddeb1db1107446fb71ded2d1cbe5b79afa259a3a13a5d87e8d45a63f7ba235fa485099689c30eee366bd7bace95d52db7f28cb0dcad5d35
7
- data.tar.gz: 217124b53d7294d7d4be7c6be9a1a7e6fb43e58190c30abdcbcb9e48daf0e0e3164ca9e5b617e3c08add2a83d722dac7f5dd91f8163b400008ac748f8e32d56d
6
+ metadata.gz: 198249fe85fdddfe42c8c6b5ba737653f4fd0beeda3283c5e2cacebaf4b4f4207de80d0228fb829326ff906ebcc8b3d147a60ff77f4000e07251078fdd533ad7
7
+ data.tar.gz: 825a02508773fe67342e78e34dac185338eee5ccd24ace18df3d56255705b1e2cc76f986d827a0712d7112821c2027cfe6dc4402a30f08d6093a99fb4bc8d47d
@@ -42,12 +42,8 @@ module Checks::ForemanProxy
42
42
  end
43
43
 
44
44
  def lookup_token_duration
45
- data = feature(:foreman_database). \
46
- query("select s.value, s.default from settings s \
47
- where category IN ('Setting::Provisioning','Setting') \
48
- and name = 'token_duration'")
49
-
50
- YAML.load(data[0]['value'] || data[0]['default'])
45
+ data = feature(:hammer).run('--output yaml settings info --id token_duration')
46
+ YAML.load(data)['Value']
51
47
  end
52
48
  end
53
49
  end
@@ -144,7 +144,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
144
144
 
145
145
  cmd = "curl -w '\n%{http_code}' -s "
146
146
  cmd += format_shell_args('--cert' => ssl_cert, '--key' => ssl_key, '--cacert' => ssl_ca)
147
- cmd += " https://$(hostname):#{proxy_settings[:https_port]}"
147
+ cmd += " https://#{hostname}:#{proxy_settings[:https_port]}"
148
148
  cmd
149
149
  end
150
150
 
@@ -17,6 +17,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
17
17
  Actions::Candlepin::ListenOnCandlepinEvents
18
18
  Actions::Katello::EventQueue::Monitor
19
19
  Actions::Insights::EmailPoller
20
+ ForemanInventoryUpload::Async::GenerateAllReportsJob
20
21
  ForemanInventoryUpload::Async::GenerateReportJob
21
22
  ForemanInventoryUpload::Async::QueueForUploadJob
22
23
  ForemanInventoryUpload::Async::UploadReportJob
@@ -24,6 +25,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
24
25
  InsightsCloud::Async::InsightsFullSync
25
26
  InsightsCloud::Async::InsightsResolutionsSync
26
27
  InsightsCloud::Async::InsightsRulesSync
28
+ InsightsCloud::Async::InsightsScheduledSync
27
29
  InventorySync::Async::InventoryFullSync
28
30
  InventorySync::Async::InventoryHostsSync
29
31
  InventorySync::Async::InventoryScheduledSync
@@ -0,0 +1,28 @@
1
+ class Features::Mosquitto < ForemanMaintain::Feature
2
+ metadata do
3
+ label :mosquitto
4
+
5
+ confine do
6
+ # Luckily, the service name is the same as the package providing it
7
+ find_package(service_name)
8
+ end
9
+ end
10
+
11
+ def services
12
+ [system_service(self.class.service_name, 10)]
13
+ end
14
+
15
+ def config_files
16
+ [self.class.etc_prefix]
17
+ end
18
+
19
+ class << self
20
+ def etc_prefix
21
+ '/etc/mosquitto'
22
+ end
23
+
24
+ def service_name
25
+ 'mosquitto'
26
+ end
27
+ end
28
+ end
@@ -33,12 +33,22 @@ class Features::SyncPlans < ForemanMaintain::Feature
33
33
  feature(:foreman_database).query(query).map { |r| r['id'].to_i }
34
34
  end
35
35
 
36
+ def validate_sync_plan_ids(ids)
37
+ ids_condition = ids.map { |id| "'#{id}'" }.join(',')
38
+ query = <<-SQL
39
+ SELECT id FROM katello_sync_plans WHERE id IN (#{ids_condition})
40
+ SQL
41
+ feature(:foreman_database).query(query).map { |r| r['id'].to_i }
42
+ end
43
+
36
44
  def make_disable(ids)
37
45
  update_records(ids, false)
38
46
  end
39
47
 
40
48
  def make_enable
41
- update_records(data[:disabled], true)
49
+ # remove ids of sync plans which no longer exist in DB
50
+ @data[:disabled] = validate_sync_plan_ids(@data[:disabled])
51
+ update_records(@data[:disabled], true)
42
52
  end
43
53
 
44
54
  def load_from_storage(storage)
@@ -51,13 +51,11 @@ class Features::Tar < ForemanMaintain::Feature
51
51
  end
52
52
 
53
53
  if volume_size
54
- split_tar_script = default_split_tar_script
55
54
  tar_command << "--tape-length=#{volume_size}"
56
- tar_command << "--new-volume-script=#{split_tar_script}"
57
55
  end
58
56
 
59
57
  tar_command << '--overwrite' if options[:overwrite]
60
- tar_command << '--gzip' if options[:gzip]
58
+ tar_command << (options[:gzip] ? '--gzip' : "--new-volume-script=#{default_split_tar_script}")
61
59
 
62
60
  exclude = options.fetch(:exclude, [])
63
61
  exclude.each do |ex|
@@ -0,0 +1,22 @@
1
+ module Procedures::Restore
2
+ class ReindexDatabases < ForemanMaintain::Procedure
3
+ include ForemanMaintain::Concerns::SystemService
4
+
5
+ metadata do
6
+ description 'REINDEX databases'
7
+
8
+ confine do
9
+ feature(:instance).postgresql_local?
10
+ end
11
+ end
12
+
13
+ def run
14
+ with_spinner('Reindexing the databases') do |spinner|
15
+ feature(:service).handle_services(spinner, 'start', :only => ['postgresql'])
16
+
17
+ spinner.update('Reindexing the databases')
18
+ execute!('runuser - postgres -c "reindexdb -a"')
19
+ end
20
+ end
21
+ end
22
+ end
@@ -45,6 +45,11 @@ module ForemanMaintain::Scenarios
45
45
  add_step(Procedures::Service::Stop.new(:only => ['postgresql']))
46
46
  end
47
47
  restore_mongo_dump(backup)
48
+
49
+ if feature(:instance).postgresql_local? && !backup.online_backup?
50
+ add_step_with_context(Procedures::Restore::ReindexDatabases)
51
+ end
52
+
48
53
  add_steps_with_context(Procedures::Pulp::Migrate,
49
54
  Procedures::Pulpcore::Migrate,
50
55
  Procedures::Restore::CandlepinResetMigrations)
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.2.3'.freeze
2
+ VERSION = '1.2.5'.freeze
3
3
  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.2.3
4
+ version: 1.2.5
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-01-05 00:00:00.000000000 Z
11
+ date: 2023-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -217,6 +217,7 @@ files:
217
217
  - definitions/features/katello.rb
218
218
  - definitions/features/katello_install.rb
219
219
  - definitions/features/mongo.rb
220
+ - definitions/features/mosquitto.rb
220
221
  - definitions/features/nftables.rb
221
222
  - definitions/features/pulp2.rb
222
223
  - definitions/features/pulpcore.rb
@@ -324,6 +325,7 @@ files:
324
325
  - definitions/procedures/restore/postgres_owner.rb
325
326
  - definitions/procedures/restore/pulpcore_dump.rb
326
327
  - definitions/procedures/restore/regenerate_queues.rb
328
+ - definitions/procedures/restore/reindex_databases.rb
327
329
  - definitions/procedures/selinux/set_file_security.rb
328
330
  - definitions/procedures/service/base.rb
329
331
  - definitions/procedures/service/daemon_reload.rb
@@ -495,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
495
497
  - !ruby/object:Gem::Version
496
498
  version: '0'
497
499
  requirements: []
498
- rubygems_version: 3.3.26
500
+ rubygems_version: 3.2.33
499
501
  signing_key:
500
502
  specification_version: 4
501
503
  summary: Foreman maintenance tool belt