foreman_maintain 1.6.9 → 1.6.11

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: cdd4ef357f342501b15fbaf461be19952c2d09fde6fb7c1f3523711201ef3faa
4
- data.tar.gz: cc9b2d323a171c5676276767f11c4a83adc5123fab01f58114d88a80a3ddba13
3
+ metadata.gz: 251038c33fba4faa2abf9c839937e229a664703c9b3003376b4d88aa7eca7d02
4
+ data.tar.gz: 72f4bb7fe9e7a9862df58accbfa190019a3356e99917d884242ad90259743291
5
5
  SHA512:
6
- metadata.gz: fffefa90d5f28514280c732cb232003acb543420a9ca9fd5a9cf77749beecb1533a05d71bb6b7c5db1e3e06dcb5909a5fa3e8f85ef3a98ae369f090cef84c052
7
- data.tar.gz: cb4997dcbb7eba53f9e4d82445ad327316e3a1ace686e62ffd0b3f4a63ecd418542d73c42d7fe10692fb48054dc902b42faaff2772c744e91c421160210fec13
6
+ metadata.gz: 140782d6ee833f07a64b2310fd94901f42991dc9babb2368cdc48c904fe78122c6e8ae6584bdb7c2818883e6c425035288d9f2859b7983d5957a5366c7c1a13a
7
+ data.tar.gz: 127c879d335e5dc46151d31e02d9fb72c4f45bcaff5ffcd83dee2ae1552877952a2b7128b28e45c69cab779df7055025e9bfdfa014bc484ae17ef2ffdd595ad3
@@ -12,15 +12,15 @@ module Checks
12
12
 
13
13
  def run
14
14
  current_db_version = feature(:foreman_database).db_version
15
- fail!(db_upgrade_message(current_db_version)) if current_db_version.major < 12
15
+ fail!(db_upgrade_message(current_db_version)) if current_db_version.major < 13
16
16
  end
17
17
 
18
18
  def db_upgrade_message(db_version)
19
19
  product_name = feature(:instance).product_name
20
20
 
21
21
  "\n\n*** ERROR: Server is running on PostgreSQL #{db_version} database.\n"\
22
- "*** Newer version of #{product_name} supports only PostgreSQL version 12.\n"\
23
- "*** Before proceeding further, you must upgrade database to PostgreSQL 12.\n"
22
+ "*** Newer version of #{product_name} supports only PostgreSQL version 13.\n"\
23
+ "*** Before proceeding further, you must upgrade database to PostgreSQL 13.\n"
24
24
  end
25
25
  end
26
26
  end
@@ -18,4 +18,8 @@ class Features::Capsule < ForemanMaintain::Feature
18
18
  def package_name
19
19
  'satellite-capsule'
20
20
  end
21
+
22
+ def module_name
23
+ 'satellite-capsule'
24
+ end
21
25
  end
@@ -9,10 +9,6 @@ class Features::Katello < ForemanMaintain::Feature
9
9
  end
10
10
  end
11
11
 
12
- def data_dirs
13
- @dirs ||= ['/var/lib/pulp', '/var/lib/pgsql']
14
- end
15
-
16
12
  def current_version
17
13
  @current_version ||= package_version('katello')
18
14
  end
@@ -22,6 +22,10 @@ class Features::Satellite < ForemanMaintain::Feature
22
22
  'satellite'
23
23
  end
24
24
 
25
+ def module_name
26
+ 'satellite'
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def version_from_source
@@ -6,18 +6,29 @@ module Procedures::Backup
6
6
  param :backup_dir, 'Directory where to backup to', :required => true
7
7
  param :preserve_dir, 'Directory where to backup to', :flag => true
8
8
  param :incremental_dir, 'Changes since specified backup only'
9
+ param :online_backup, 'Select for online backup', :flag => true, :default => false
9
10
  end
10
11
 
12
+ # rubocop:disable Metrics/MethodLength
11
13
  def run
12
- puts "Creating backup folder #{@backup_dir}"
13
-
14
14
  unless @preserve_dir
15
+ puts "Creating backup folder #{@backup_dir}"
16
+
15
17
  FileUtils.mkdir_p @backup_dir
16
18
  FileUtils.chmod_R 0o770, @backup_dir
17
- end
18
19
 
19
- if feature(:instance).postgresql_local? && !@preserve_dir
20
- FileUtils.chown_R(nil, 'postgres', @backup_dir)
20
+ if feature(:instance).postgresql_local? && @online_backup
21
+ begin
22
+ FileUtils.chown_R(nil, 'postgres', @backup_dir)
23
+ rescue Errno::EPERM
24
+ warn_msg = <<~MSG
25
+ #{@backup_dir} could not be made readable by the 'postgres' user.
26
+ This won't affect the backup procedure, but you have to ensure that
27
+ the 'postgres' user can read the data during restore.
28
+ MSG
29
+ set_status(:warning, warn_msg)
30
+ end
31
+ end
21
32
  end
22
33
 
23
34
  FileUtils.rm(Dir.glob(File.join(@backup_dir, '.*.snar'))) if @preserve_dir
@@ -30,5 +41,6 @@ module Procedures::Backup
30
41
  end
31
42
  end
32
43
  end
44
+ # rubocop:enable Metrics/MethodLength
33
45
  end
34
46
  end
@@ -18,6 +18,10 @@ class Procedures::HammerSetup < ForemanMaintain::Procedure
18
18
  end
19
19
 
20
20
  def necessary?
21
- !feature(:hammer).check_connection
21
+ if feature(:hammer)
22
+ !feature(:hammer).check_connection
23
+ else
24
+ false
25
+ end
22
26
  end
23
27
  end
@@ -8,11 +8,18 @@ module Procedures::Packages
8
8
 
9
9
  def run
10
10
  if @packages.nil? || @packages.empty?
11
- question = "\nWARNING: No specific packages to update were provided\n" \
12
- "so we are going to update all available packages.\n" \
13
- "To Upgrade to next version use 'foreman-maintain upgrade'.\n\n" \
14
- "Do you want to proceed with update of everything regardless\n" \
15
- 'of the recommendations?'
11
+ command = ForemanMaintain.command_name
12
+
13
+ question = <<~MSG
14
+ WARNING: No specific packages to update were provided
15
+ so we are going to update all available packages. We
16
+ recommend using the update command to update to a minor
17
+ version and/or operating system using '#{command} update'.
18
+ To upgrade to the next #{feature(:instance).product_name} version use '#{command} upgrade'.
19
+ Do you want to proceed with update of everything regardless of
20
+ the recommendations?
21
+ MSG
22
+
16
23
  answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
17
24
  abort! unless answer == :yes
18
25
  end
@@ -17,9 +17,6 @@ module Procedures::Pulpcore
17
17
  spinner.update('Adding image metadata to pulp. You can continue using the ' \
18
18
  'system normally while the task runs in the background.')
19
19
  execute!(pulpcore_manager('container-handle-image-data'))
20
- spinner.update('Adding image metadata to katello. You can continue using the ' \
21
- 'system normally while the task runs in the background.')
22
- execute!('foreman-rake katello:import_container_manifest_labels')
23
20
  end
24
21
  end
25
22
  end
@@ -0,0 +1,17 @@
1
+ module Procedures::Repositories
2
+ class IndexKatelloRepositoriesContainerMetatdata < ForemanMaintain::Procedure
3
+ metadata do
4
+ description 'Import container manifest metadata'
5
+ confine do
6
+ feature(:katello)
7
+ end
8
+ end
9
+
10
+ def run
11
+ with_spinner(('Adding image metadata. You can continue using the ' \
12
+ 'system normally while the task runs in the background.')) do
13
+ execute!('foreman-rake katello:import_container_manifest_labels')
14
+ end
15
+ end
16
+ end
17
+ end
@@ -20,7 +20,8 @@ module ForemanMaintain::Scenarios
20
20
  check_valid_strategy
21
21
  safety_confirmation
22
22
  add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
23
- add_step_with_context(Procedures::Backup::PrepareDirectory)
23
+ add_step_with_context(Procedures::Backup::PrepareDirectory,
24
+ :online_backup => strategy == :online)
24
25
  add_step_with_context(Procedures::Backup::Metadata, :online_backup => strategy == :online)
25
26
 
26
27
  case strategy
@@ -81,15 +82,13 @@ module ForemanMaintain::Scenarios
81
82
  include_dumps if include_db_dumps?
82
83
  add_step_with_context(Procedures::ForemanProxy::Features, :load_only => true)
83
84
  add_steps_with_context(
84
- find_procedures(:maintenance_mode_on),
85
85
  Procedures::Service::Stop,
86
86
  Procedures::Backup::ConfigFiles,
87
87
  Procedures::Backup::Pulp,
88
88
  Procedures::Backup::Offline::CandlepinDB,
89
89
  Procedures::Backup::Offline::ForemanDB,
90
90
  Procedures::Backup::Offline::PulpcoreDB,
91
- Procedures::Service::Start,
92
- find_procedures(:maintenance_mode_off)
91
+ Procedures::Service::Start
93
92
  )
94
93
  end
95
94
 
@@ -138,7 +137,6 @@ module ForemanMaintain::Scenarios
138
137
  def compose
139
138
  if strategy == :offline
140
139
  add_step_with_context(Procedures::Service::Start)
141
- add_steps_with_context(find_procedures(:maintenance_mode_off))
142
140
  end
143
141
  add_step_with_context(Procedures::Backup::Clean)
144
142
  end
@@ -135,7 +135,8 @@ module Scenarios::ForemanUpgrade
135
135
  Checks::ServicesUp,
136
136
  Checks::SystemRegistration,
137
137
  Procedures::Packages::CheckForReboot,
138
- Procedures::Pulpcore::ContainerHandleImageMetadata
138
+ Procedures::Pulpcore::ContainerHandleImageMetadata,
139
+ Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata
139
140
  )
140
141
  end
141
142
  end
@@ -4,7 +4,7 @@ module Scenarios::Satellite
4
4
  metadata do
5
5
  tags :upgrade_scenario
6
6
  confine do
7
- (feature(:downstream).current_minor_version == '6.15' || \
7
+ (feature(:instance).downstream&.current_minor_version == '6.15' || \
8
8
  ForemanMaintain.upgrade_in_progress == '6.16')
9
9
  end
10
10
  instance_eval(&block)
@@ -60,7 +60,7 @@ module Scenarios::Satellite
60
60
  if el8?
61
61
  modules_to_switch = ['postgresql:13']
62
62
  add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
63
- modules_to_enable = ["satellite:#{el_short_name}"]
63
+ modules_to_enable = ["#{feature(:instance).downstream.module_name}:#{el_short_name}"]
64
64
  add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
65
65
  end
66
66
  add_step(Procedures::Packages::Update.new(
@@ -99,6 +99,7 @@ module Scenarios::Satellite
99
99
  add_steps(find_checks(:post_upgrade))
100
100
  add_step(Procedures::Packages::CheckForReboot)
101
101
  add_step(Procedures::Pulpcore::ContainerHandleImageMetadata)
102
+ add_step(Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata)
102
103
  end
103
104
  end
104
105
  end
@@ -46,7 +46,7 @@ module ForemanMaintain
46
46
  def finish_update
47
47
  @finished = true
48
48
  @reporter.hline
49
- @reporter.puts("Update finished.")
49
+ @reporter.puts("Update finished.\n")
50
50
  end
51
51
 
52
52
  def storage
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.6.9'.freeze
2
+ VERSION = '1.6.11'.freeze
3
3
  end
@@ -174,6 +174,10 @@ module ForemanMaintain
174
174
  [main_package_name, 'foreman-maintain']
175
175
  end
176
176
 
177
+ def command_name
178
+ pkg_and_cmd_name[1]
179
+ end
180
+
177
181
  def perform_self_upgrade
178
182
  package_name, command = pkg_and_cmd_name
179
183
 
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.6.9
4
+ version: 1.6.11
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: 2024-06-11 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -284,6 +284,7 @@ files:
284
284
  - definitions/procedures/repositories/backup_enabled_repos.rb
285
285
  - definitions/procedures/repositories/disable.rb
286
286
  - definitions/procedures/repositories/enable.rb
287
+ - definitions/procedures/repositories/index_katello_repositories_container_metadata.rb
287
288
  - definitions/procedures/repositories/setup.rb
288
289
  - definitions/procedures/restore/candlepin_dump.rb
289
290
  - definitions/procedures/restore/configs.rb
@@ -292,7 +293,6 @@ files:
292
293
  - definitions/procedures/restore/extract_files.rb
293
294
  - definitions/procedures/restore/foreman_dump.rb
294
295
  - definitions/procedures/restore/installer_reset.rb
295
- - definitions/procedures/restore/postgres_owner.rb
296
296
  - definitions/procedures/restore/pulpcore_dump.rb
297
297
  - definitions/procedures/restore/reindex_databases.rb
298
298
  - definitions/procedures/restore/required_packages.rb
@@ -1,18 +0,0 @@
1
- module Procedures::Restore
2
- class PostgresOwner < ForemanMaintain::Procedure
3
- include ForemanMaintain::Concerns::SystemHelpers
4
- metadata do
5
- description 'Make postgres owner of backup directory'
6
-
7
- param :backup_dir,
8
- 'Path to backup directory',
9
- :required => true
10
- end
11
-
12
- def run
13
- if feature(:instance).foreman_proxy_with_content?
14
- FileUtils.chown(nil, 'postgres', @backup_dir)
15
- end
16
- end
17
- end
18
- end