foreman_maintain 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/definitions/checks/disk/performance.rb +1 -1
  3. data/definitions/features/dynflow_sidekiq.rb +39 -0
  4. data/definitions/features/foreman_proxy.rb +15 -4
  5. data/definitions/features/foreman_tasks.rb +3 -8
  6. data/definitions/features/instance.rb +6 -2
  7. data/definitions/features/katello.rb +0 -7
  8. data/definitions/features/mongo.rb +1 -1
  9. data/definitions/features/{pulp.rb → pulp2.rb} +1 -1
  10. data/definitions/features/pulp3.rb +22 -0
  11. data/definitions/features/puppet_server.rb +2 -6
  12. data/definitions/features/redis.rb +34 -0
  13. data/definitions/features/tar.rb +18 -18
  14. data/definitions/procedures/backup/config_files.rb +43 -13
  15. data/definitions/procedures/backup/prepare_directory.rb +1 -8
  16. data/definitions/procedures/backup/pulp.rb +3 -3
  17. data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -1
  18. data/definitions/procedures/backup/snapshot/mount_pulp.rb +3 -3
  19. data/definitions/procedures/content/prepare.rb +12 -0
  20. data/definitions/procedures/packages/installer_confirmation.rb +1 -1
  21. data/definitions/procedures/pulp/migrate.rb +1 -1
  22. data/definitions/procedures/restore/configs.rb +7 -0
  23. data/definitions/procedures/restore/extract_files.rb +0 -1
  24. data/definitions/procedures/restore/mongo_dump.rb +2 -2
  25. data/definitions/procedures/service/base.rb +1 -1
  26. data/definitions/scenarios/backup.rb +1 -2
  27. data/definitions/scenarios/packages.rb +3 -7
  28. data/extras/foreman_protector/foreman-protector.py +1 -1
  29. data/lib/foreman_maintain/cli/packages_command.rb +1 -1
  30. data/lib/foreman_maintain/concerns/downstream.rb +2 -1
  31. data/lib/foreman_maintain/concerns/system_helpers.rb +9 -7
  32. data/lib/foreman_maintain/feature.rb +0 -4
  33. data/lib/foreman_maintain/reporter/cli_reporter.rb +3 -3
  34. data/lib/foreman_maintain/utils/disk/io_device.rb +1 -1
  35. data/lib/foreman_maintain/utils/facter.rb +1 -1
  36. data/lib/foreman_maintain/utils/service/abstract.rb +2 -1
  37. data/lib/foreman_maintain/utils/service/systemd.rb +26 -2
  38. data/lib/foreman_maintain/version.rb +1 -1
  39. metadata +165 -163
  40. data/definitions/checks/foreman/check_duplicate_permission.rb +0 -33
  41. data/definitions/procedures/foreman/remove_duplicate_permissions.rb +0 -70
  42. data/definitions/procedures/packages/update_all_confirmation.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: d771ecfd4783e176608d1a0263299997e9dcf3f60c141b20be197d61a726085c
4
- data.tar.gz: b90a67972a8b670b25ab8eab34aac663239244f170e2bd31a7a617e576cd41c0
2
+ SHA1:
3
+ metadata.gz: 9cf2de71b1fd3ab00b7305e517b1529428af64ef
4
+ data.tar.gz: 5fe408d0a49b4e196c27d81cf9e732fd994358a2
5
5
  SHA512:
6
- metadata.gz: 0b215ba50227dab2f5d95db8046d078212ccf7cb5fe6dc450a77488472c293bad4b70b3384b477b095cde78d4428e1033af8fd3f2f13d42588e5867834e58903
7
- data.tar.gz: ffea4e522836f6e28a32f2c6ad33a1ca0c3449561eed1104d11c5308e79dd695706cdc2cf41ea34d80201bbf591fca65a73d5b83aa32abfe8366b932c90eaef3
6
+ metadata.gz: 2588c117972fcc18c28fd503b945a9f00313906df3ac225af45ccb0a973e406d31bddd191d84937e3778718fae7e9a45cb7c2b57c812815a65f8922d29b0519b
7
+ data.tar.gz: 8973ea5b1105d668c3e493cb49e68c95e01bccb298f6fa7c2fa702dd629b781d460aca39a72a8a20d5e6e68e8c92adb6dd3e2678e960f1d976d9d23fcfd6708c
@@ -8,7 +8,7 @@ module Checks
8
8
  preparation_steps { Procedures::Packages::Install.new(:packages => %w[fio]) }
9
9
 
10
10
  confine do
11
- feature(:pulp)
11
+ feature(:instance).pulp
12
12
  end
13
13
  end
14
14
 
@@ -0,0 +1,39 @@
1
+ class Features::DynflowSidekiq < ForemanMaintain::Feature
2
+ metadata do
3
+ label :dynflow_sidekiq
4
+
5
+ confine do
6
+ server? && find_package('foreman-dynflow-sidekiq')
7
+ end
8
+ end
9
+
10
+ def services
11
+ service_names.map { |service| system_service service, instance_priority(service) }
12
+ end
13
+
14
+ def config_files
15
+ # Workaround until foreman-installer can deploy scaled workers
16
+ service_symlinks = configured_services.map do |service|
17
+ "/etc/systemd/system/multi-user.target.wants/#{service}.service"
18
+ end
19
+ [
20
+ '/etc/foreman/dynflow',
21
+ service_symlinks
22
+ ].flatten
23
+ end
24
+
25
+ private
26
+
27
+ def instance_priority(instance)
28
+ # Orchestrator should be started before the workers are
29
+ instance.end_with?('@orchestrator') ? 30 : 31
30
+ end
31
+
32
+ def service_names
33
+ configured_instances.map { |instance| "dynflow-sidekiq@#{instance}" }
34
+ end
35
+
36
+ def configured_instances
37
+ Dir['/etc/foreman/dynflow/*'].map { |config| File.basename(config, '.yml') }
38
+ end
39
+ end
@@ -17,7 +17,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
17
17
  end
18
18
 
19
19
  def with_content?
20
- !!feature(:pulp)
20
+ !!feature(:instance).pulp
21
21
  end
22
22
 
23
23
  def dhcpd_conf_exist?
@@ -79,17 +79,26 @@ class Features::ForemanProxy < ForemanMaintain::Feature
79
79
 
80
80
  def content_module
81
81
  return @content_module if @content_module_detected
82
+
82
83
  @content_module_detected = true
83
84
  answer = feature(:installer).answers.find do |_, config|
84
- config.is_a?(Hash) && config.key?('certs_tar')
85
+ config.is_a?(Hash) && config.key?(certs_param_name[:param_key])
85
86
  end
86
- @content_module = answer.nil? ? 'foreman_proxy_content' : answer.first
87
+ @content_module = answer.nil? ? certs_param_name[:param_section] : answer.first
87
88
  logger.debug("foreman proxy content module detected: #{@content_module}")
88
89
  @content_module
89
90
  end
90
91
 
92
+ def certs_param_name
93
+ if check_min_version('foreman', '1.21')
94
+ return { :param_section => 'certs', :param_key => 'tar_file' }
95
+ end
96
+
97
+ { :param_section => 'foreman_proxy_content', :param_key => 'certs_tar' }
98
+ end
99
+
91
100
  def certs_tar
92
- feature(:installer).answers[content_module]['certs_tar'] if content_module
101
+ feature(:installer).answers[content_module][certs_param_name[:param_section]] if content_module
93
102
  end
94
103
 
95
104
  def settings_file
@@ -136,6 +145,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
136
145
  http_line = ''
137
146
  array_output.each do |str|
138
147
  next unless str.include?('HTTP')
148
+
139
149
  http_line = str
140
150
  end
141
151
  msg = http_line.split(curl_http_status.to_s).last
@@ -195,6 +205,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
195
205
  def lookup_dhcpd_config_file
196
206
  dhcpd_config_file = lookup_using_dhcp_yml
197
207
  raise "Couldn't find DHCP Configuration file" if dhcpd_config_file.nil?
208
+
198
209
  dhcpd_config_file
199
210
  end
200
211
 
@@ -108,7 +108,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
108
108
  end
109
109
 
110
110
  def services
111
- [system_service(service_name, 30)]
111
+ feature(:dynflow_sidekiq) ? [] : [system_service(service_name, 30)]
112
112
  end
113
113
 
114
114
  def service_name
@@ -162,13 +162,8 @@ class Features::ForemanTasks < ForemanMaintain::Feature
162
162
  def export_csv(sql, file_name, state)
163
163
  dir = prepare_for_backup(state)
164
164
  filepath = "#{dir}/#{file_name}"
165
- csv_output = feature(:foreman_database).query_csv(sql)
166
- File.open(filepath, 'w') do |f|
167
- f.write(csv_output)
168
- f.close
169
- end
170
- execute("bzip2 #{filepath} -c -9 > #{filepath}.bz2")
171
- FileUtils.rm_rf(filepath)
165
+ execute("echo \"COPY (#{sql}) TO STDOUT WITH CSV;\" \
166
+ | su - postgres -c '/usr/bin/psql -d foreman' | bzip2 -9 > #{filepath}.bz2")
172
167
  end
173
168
 
174
169
  def old_tasks_condition(state = "'stopped', 'paused'")
@@ -64,6 +64,10 @@ class Features::Instance < ForemanMaintain::Feature
64
64
  net
65
65
  end
66
66
 
67
+ def pulp
68
+ feature(:pulp2) || feature(:pulp3)
69
+ end
70
+
67
71
  private
68
72
 
69
73
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
@@ -137,8 +141,8 @@ class Features::Instance < ForemanMaintain::Feature
137
141
  {
138
142
  'candlepin_auth' => %w[candlepin candlepin_database],
139
143
  'candlepin' => %w[candlepin candlepin_database],
140
- 'pulp_auth' => %w[pulp mongo],
141
- 'pulp' => %w[pulp mongo],
144
+ 'pulp_auth' => %w[pulp2 mongo],
145
+ 'pulp' => %w[pulp2 mongo],
142
146
  'foreman_tasks' => %w[foreman_tasks]
143
147
  }
144
148
  end
@@ -52,13 +52,6 @@ class Features::Katello < ForemanMaintain::Feature
52
52
  end
53
53
  # rubocop:enable Metrics/MethodLength
54
54
 
55
- def config_files_exclude_for_online
56
- [
57
- '/var/lib/qpidd',
58
- '/var/lib/candlepin/activemq-artemis'
59
- ]
60
- end
61
-
62
55
  private
63
56
 
64
57
  def installer_scenario_answers
@@ -9,7 +9,7 @@ class Features::Mongo < ForemanMaintain::Feature
9
9
  label :mongo
10
10
 
11
11
  confine do
12
- feature(:pulp)
12
+ feature(:pulp2)
13
13
  end
14
14
  end
15
15
 
@@ -2,7 +2,7 @@ class Features::Pulp < ForemanMaintain::Feature
2
2
  include ForemanMaintain::Concerns::DirectoryMarker
3
3
 
4
4
  metadata do
5
- label :pulp
5
+ label :pulp2
6
6
 
7
7
  confine do
8
8
  find_package('pulp-server')
@@ -0,0 +1,22 @@
1
+ require 'foreman_maintain/utils/service/systemd'
2
+
3
+ class Features::Pulp3 < ForemanMaintain::Feature
4
+ metadata do
5
+ label :pulp3
6
+
7
+ confine do
8
+ ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist?
9
+ end
10
+ end
11
+
12
+ def services
13
+ [
14
+ system_service('pulpcore-api', 10),
15
+ system_service('pulpcore-content', 10),
16
+ system_service('pulpcore-resource-manager', 10),
17
+ system_service('pulpcore-worker@*', 20, :all => true, :skip_enablement => true),
18
+ system_service('rh-redis5-redis', 30),
19
+ system_service('httpd', 30)
20
+ ]
21
+ end
22
+ end
@@ -29,7 +29,7 @@ class Features::PuppetServer < ForemanMaintain::Feature
29
29
  end
30
30
 
31
31
  def puppet_version
32
- version(execute!("#{puppet_path} --version"))
32
+ version(execute!('puppet --version'))
33
33
  end
34
34
 
35
35
  def find_empty_cacert_request_files
@@ -56,10 +56,6 @@ class Features::PuppetServer < ForemanMaintain::Feature
56
56
  end
57
57
 
58
58
  def puppet_ssldir_path
59
- execute!("#{puppet_path} config print ssldir")
60
- end
61
-
62
- def puppet_path
63
- '/opt/puppetlabs/bin/puppet'
59
+ execute!('puppet master --configprint ssldir')
64
60
  end
65
61
  end
@@ -0,0 +1,34 @@
1
+ class Features::Redis < ForemanMaintain::Feature
2
+ metadata do
3
+ label :redis
4
+
5
+ confine do
6
+ # Luckily, the service name is the same as the package providing it
7
+ server? && 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
+ %w[redis redis.conf].map { |config| File.join(self.class.etc_prefix, config) }
17
+ end
18
+
19
+ class << self
20
+ SCL_NAME = 'rh-redis5'.freeze
21
+
22
+ def etc_prefix
23
+ "/etc/opt/rh/#{SCL_NAME}"
24
+ end
25
+
26
+ def scl_prefix
27
+ "#{SCL_NAME}-"
28
+ end
29
+
30
+ def service_name
31
+ "#{scl_prefix}redis"
32
+ end
33
+ end
34
+ end
@@ -20,11 +20,24 @@ class Features::Tar < ForemanMaintain::Feature
20
20
  # @option options [Boolean] :gzip filter the archive through gzip
21
21
  # @option options [Boolean] :ignore_failed_read do not fail on missing files
22
22
  # @option options [Boolean] :allow_changing_files do not fail on changing files
23
+ def run(options = {})
24
+ logger.debug("Invoking tar from #{options[:directory] || FileUtils.pwd}")
25
+ statuses = options[:allow_changing_files] ? [0, 1] : [0]
26
+ execute!(tar_command(options), :valid_exit_statuses => statuses)
27
+ end
28
+
29
+ def validate_volume_size(size)
30
+ if size.nil? || size !~ /^\d+[bBcGKkMPTw]?$/
31
+ raise ForemanMaintain::Error::Validation,
32
+ "Please specify size according to 'tar --tape-length' format."
33
+ end
34
+ true
35
+ end
36
+
23
37
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
24
38
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
25
- def run(options = {})
39
+ def tar_command(options)
26
40
  volume_size = options.fetch(:volume_size, nil)
27
- absolute_names = options.fetch(:absolute_names, nil)
28
41
  validate_volume_size(volume_size) unless volume_size.nil?
29
42
 
30
43
  tar_command = ['tar']
@@ -32,10 +45,6 @@ class Features::Tar < ForemanMaintain::Feature
32
45
  tar_command << "--#{options.fetch(:command, 'create')}"
33
46
  tar_command << "--file=#{options.fetch(:archive)}"
34
47
 
35
- if absolute_names
36
- tar_command << '--absolute-names'
37
- end
38
-
39
48
  if volume_size
40
49
  split_tar_script = default_split_tar_script
41
50
  tar_command << "--tape-length=#{volume_size}"
@@ -66,29 +75,20 @@ class Features::Tar < ForemanMaintain::Feature
66
75
  tar_command << options.fetch(:files, '*')
67
76
  end
68
77
 
69
- logger.debug("Invoking tar from #{options[:directory] || FileUtils.pwd}")
70
- statuses = options[:allow_changing_files] ? [0, 1] : [0]
71
- execute!(tar_command.join(' '), :valid_exit_statuses => statuses)
78
+ tar_command.join(' ')
72
79
  end
73
80
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
74
81
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
75
82
 
76
- def validate_volume_size(size)
77
- if size.nil? || size !~ /^\d+[bBcGKkMPTw]?$/
78
- raise ForemanMaintain::Error::Validation,
79
- "Please specify size according to 'tar --tape-length' format."
80
- end
81
- true
82
- end
83
-
84
83
  private
85
84
 
86
85
  def default_split_tar_script
87
- utils_path = File.expand_path('../../../bin', __FILE__)
86
+ utils_path = File.expand_path('../../bin', __dir__)
88
87
  split_tar_script = File.join(utils_path, 'foreman-maintain-rotate-tar')
89
88
  unless File.executable?(split_tar_script)
90
89
  raise ForemanMaintain::Error::Fail, "Script #{split_tar_script} is not executable"
91
90
  end
91
+
92
92
  split_tar_script
93
93
  end
94
94
  end
@@ -1,5 +1,8 @@
1
1
  module Procedures::Backup
2
2
  class ConfigFiles < ForemanMaintain::Procedure
3
+ MAX_RETRIES = 3
4
+ RETRY_DELAY = 10
5
+
3
6
  metadata do
4
7
  description 'Backup config files'
5
8
  tags :backup
@@ -8,28 +11,39 @@ module Procedures::Backup
8
11
  Checks::Backup::CertsTarExist.new
9
12
  end
10
13
  end
14
+
11
15
  param :backup_dir, 'Directory where to backup to', :required => true
12
16
  param :proxy_features, 'List of proxy features to backup (default: all)',
13
17
  :array => true, :default => ['all']
14
18
  param :ignore_changed_files, 'Should packing tar ignore changed files',
15
19
  :flag => true, :default => false
16
- param :online_backup, 'The config files are being prepared for an online backup',
17
- :flag => true, :default => false
18
20
  end
19
21
 
22
+ # rubocop:disable Metrics/MethodLength
20
23
  def run
21
- tarball = File.join(@backup_dir, 'config_files.tar.gz')
22
- increments = File.join(@backup_dir, '.config.snar')
23
- with_spinner('Collecting config files to backup') do
24
- configs, to_exclude = config_files
25
- feature(:tar).run(
26
- :command => 'create', :gzip => true, :archive => tarball,
27
- :listed_incremental => increments, :ignore_failed_read => true,
28
- :exclude => to_exclude, :allow_changing_files => @ignore_changed_files,
29
- :files => configs.join(' ')
30
- )
24
+ logger.debug("Invoking tar from #{FileUtils.pwd}")
25
+ tar_cmd = tar_command
26
+ attempt_no = 1
27
+ loop do
28
+ runner = nil
29
+ with_spinner('Collecting config files to backup') do
30
+ runner = execute_runner(tar_cmd, :valid_exit_statuses => [0, 1])
31
+ end
32
+ break if runner.exit_status == 0 || @ignore_changed_files
33
+
34
+ puts "WARNING: Attempt #{attempt_no}/#{MAX_RETRIES} to collect all config files failed!"
35
+ puts 'Some files were modified during creation of the archive.'
36
+ if attempt_no == MAX_RETRIES
37
+ raise runner.execution_error
38
+ else
39
+ attempt_no += 1
40
+ FileUtils.rm_rf(tarball_path)
41
+ puts "Waiting #{RETRY_DELAY} seconds before re-try"
42
+ sleep(RETRY_DELAY)
43
+ end
31
44
  end
32
45
  end
46
+ # rubocop:enable Metrics/MethodLength
33
47
 
34
48
  # rubocop:disable Metrics/AbcSize
35
49
  def config_files
@@ -41,7 +55,6 @@ module Procedures::Backup
41
55
 
42
56
  configs += feature.config_files
43
57
  exclude_configs += feature.config_files_to_exclude
44
- exclude_configs += feature.config_files_exclude_for_online if @online_backup
45
58
  end
46
59
 
47
60
  if feature(:foreman_proxy)
@@ -54,5 +67,22 @@ module Procedures::Backup
54
67
  [configs, exclude_configs]
55
68
  end
56
69
  # rubocop:enable Metrics/AbcSize
70
+
71
+ private
72
+
73
+ def tar_command
74
+ increments_path = File.join(@backup_dir, '.config.snar')
75
+ configs, to_exclude = config_files
76
+
77
+ feature(:tar).tar_command(
78
+ :command => 'create', :gzip => true, :archive => tarball_path,
79
+ :listed_incremental => increments_path, :ignore_failed_read => true,
80
+ :exclude => to_exclude, :files => configs.join(' ')
81
+ )
82
+ end
83
+
84
+ def tarball_path
85
+ @tarball_path ||= File.join(@backup_dir, 'config_files.tar.gz')
86
+ end
57
87
  end
58
88
  end
@@ -8,7 +8,6 @@ module Procedures::Backup
8
8
  param :incremental_dir, 'Changes since specified backup only'
9
9
  end
10
10
 
11
- # rubocop:disable Metrics/MethodLength
12
11
  def run
13
12
  puts "Creating backup folder #{@backup_dir}"
14
13
 
@@ -23,14 +22,8 @@ module Procedures::Backup
23
22
 
24
23
  FileUtils.rm(Dir.glob(File.join(@backup_dir, '.*.snar'))) if @preserve_dir
25
24
  if @incremental_dir
26
- if (snar_files = Dir.glob(File.join(@incremental_dir, '.*.snar'))).empty?
27
- raise "#{@incremental_dir}/*.snar files unavailable. "\
28
- 'Provide a valid previous backup directory'
29
- else
30
- FileUtils.cp(snar_files, @backup_dir)
31
- end
25
+ FileUtils.cp(Dir.glob(File.join(@incremental_dir, '.*.snar')), @backup_dir)
32
26
  end
33
27
  end
34
- # rubocop:enable Metrics/MethodLength
35
28
  end
36
29
  end
@@ -3,7 +3,7 @@ module Procedures::Backup
3
3
  metadata do
4
4
  description 'Backup Pulp data'
5
5
  tags :backup
6
- for_feature :pulp
6
+ for_feature :pulp2
7
7
  param :backup_dir, 'Directory where to backup to', :required => true
8
8
  param :tar_volume_size, 'Size of tar volume (indicates splitting)'
9
9
  param :ensure_unchanged, 'Ensure the data did not change during backup'
@@ -39,9 +39,9 @@ module Procedures::Backup
39
39
  end
40
40
 
41
41
  def pulp_dir
42
- return feature(:pulp).data_dir if @mount_dir.nil?
42
+ return feature(:pulp2).data_dir if @mount_dir.nil?
43
43
  mount_point = File.join(@mount_dir, 'pulp')
44
- dir = feature(:pulp).find_marked_directory(mount_point)
44
+ dir = feature(:pulp2).find_marked_directory(mount_point)
45
45
  unless dir
46
46
  raise ForemanMaintain::Error::Fail,
47
47
  "Pulp base directory not found in the mount point (#{mount_point})"
@@ -12,7 +12,7 @@ module Procedures::Backup
12
12
  backup_lv = get_lv_info(@backup_dir)
13
13
 
14
14
  dbs = {}
15
- dbs[:pulp] = 'Pulp' if feature(:pulp) && !@skip_pulp
15
+ dbs[:pulp] = 'Pulp' if feature(:pulp2) && !@skip_pulp
16
16
  dbs[:mongo] = 'Mongo' if db_local?(:mongo)
17
17
  dbs[:candlepin_database] = 'Candlepin' if db_local?(:candlepin_database)
18
18
  dbs[:foreman_database] = 'Foreman' if db_local?(:foreman_database)
@@ -5,7 +5,7 @@ module Procedures::Backup
5
5
  metadata do
6
6
  description 'Create and mount snapshot of Pulp data'
7
7
  tags :backup
8
- for_feature :pulp
8
+ for_feature :pulp2
9
9
  MountBase.common_params(self)
10
10
  param :skip, 'Skip Pulp content during backup'
11
11
  end
@@ -13,8 +13,8 @@ module Procedures::Backup
13
13
  def run
14
14
  skip if @skip
15
15
  with_spinner('Creating snapshot of Pulp') do |spinner|
16
- feature(:pulp).with_marked_directory(feature(:pulp).data_dir) do
17
- lv_info = get_lv_info(feature(:pulp).data_dir)
16
+ feature(:pulp2).with_marked_directory(feature(:pulp2).data_dir) do
17
+ lv_info = get_lv_info(feature(:pulp2).data_dir)
18
18
  create_lv_snapshot('pulp-snap', @block_size, lv_info[0])
19
19
  spinner.update("Mounting snapshot of Pulp on #{mount_location('pulp')}")
20
20
  mount_snapshot('pulp', lv_info[1])
@@ -0,0 +1,12 @@
1
+ module Procedures::Content
2
+ class Prepare < ForemanMaintain::Procedure
3
+ metadata do
4
+ description 'Prepare content for Pulp 3'
5
+ for_feature :pulp3
6
+ end
7
+
8
+ def run
9
+ execute!('foreman-rake katello:pulp3_migration')
10
+ end
11
+ end
12
+ end
@@ -5,7 +5,7 @@ module Procedures::Packages
5
5
  end
6
6
 
7
7
  def run
8
- question = "\nWARNING: This script runs #{feature(:installer).installer_command} " \
8
+ question = "WARNING: This script runs #{feature(:installer).installer_command} " \
9
9
  "after the yum execution \n" \
10
10
  "to ensure the #{feature(:instance).product_name} " \
11
11
  "is in a consistent state.\n" \
@@ -4,7 +4,7 @@ module Procedures::Pulp
4
4
 
5
5
  metadata do
6
6
  description 'Migrate pulp db'
7
- for_feature :pulp
7
+ for_feature :pulp2
8
8
  end
9
9
 
10
10
  def run
@@ -14,6 +14,7 @@ module Procedures::Restore
14
14
  spinner.update('Restoring configs')
15
15
  clean_conflicting_data
16
16
  restore_configs(backup)
17
+ reset_qpid_jrnls
17
18
  reload_configs
18
19
  end
19
20
  end
@@ -45,5 +46,11 @@ module Procedures::Restore
45
46
  # tar is unable to --overwrite dir with symlink
46
47
  execute('rm -rf /usr/share/foreman-proxy/.ssh')
47
48
  end
49
+
50
+ def reset_qpid_jrnls
51
+ # on restore without pulp data qpid fails to start
52
+ # https://access.redhat.com/solutions/4645231
53
+ execute('rm -rf /var/lib/qpidd/.qpidd/qls/dat2/__db.00*')
54
+ end
48
55
  end
49
56
  end
@@ -29,7 +29,6 @@ module Procedures::Restore
29
29
  def base_tar
30
30
  {
31
31
  :overwrite => true,
32
- :absolute_names => true,
33
32
  :listed_incremental => '/dev/null',
34
33
  :command => 'extract',
35
34
  :directory => '/'
@@ -2,7 +2,7 @@ module Procedures::Restore
2
2
  class MongoDump < ForemanMaintain::Procedure
3
3
  metadata do
4
4
  description 'Restore mongo dump'
5
- for_feature :pulp
5
+ for_feature :pulp2
6
6
  param :backup_dir,
7
7
  'Path to backup directory',
8
8
  :required => true
@@ -10,7 +10,7 @@ module Procedures::Restore
10
10
  [Checks::Mongo::DBUp.new, Checks::Mongo::ToolsInstalled.new]
11
11
  end
12
12
  confine do
13
- feature(:mongo) && feature(:pulp)
13
+ feature(:mongo) && feature(:pulp2)
14
14
  end
15
15
  end
16
16
 
@@ -15,7 +15,7 @@ module Procedures
15
15
 
16
16
  def run_service_action(action, options)
17
17
  action_noun = feature(:service).action_noun(action).capitalize
18
- puts "#{action_noun} the following service(s):\n"
18
+ puts "\n#{action_noun} the following service(s):"
19
19
  services = feature(:service).filtered_services(options)
20
20
  print_services(services)
21
21
 
@@ -186,8 +186,7 @@ module ForemanMaintain::Scenarios
186
186
  # rubocop:enable Metrics/MethodLength
187
187
 
188
188
  def add_online_backup_steps
189
- add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true,
190
- :online_backup => true)
189
+ add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true)
191
190
  add_step_with_context(Procedures::Backup::Pulp, :ensure_unchanged => true)
192
191
  add_steps_with_context(
193
192
  Procedures::Backup::Online::Mongo,
@@ -71,11 +71,8 @@ module ForemanMaintain::Scenarios
71
71
  end
72
72
 
73
73
  def compose
74
- add_steps_with_context(
75
- Procedures::Packages::UpdateAllConfirmation,
76
- Procedures::Packages::InstallerConfirmation,
77
- Procedures::Packages::UnlockVersions
78
- )
74
+ add_step_with_context(Procedures::Packages::InstallerConfirmation)
75
+ add_step_with_context(Procedures::Packages::UnlockVersions)
79
76
  add_step_with_context(Procedures::Packages::Update, :force => true, :warn_on_errors => true)
80
77
  add_step_with_context(Procedures::Installer::Run,
81
78
  :arguments => '--upgrade --disable-system-checks')
@@ -84,8 +81,7 @@ module ForemanMaintain::Scenarios
84
81
 
85
82
  def set_context_mapping
86
83
  context.map(:packages,
87
- Procedures::Packages::Update => :packages,
88
- Procedures::Packages::UpdateAllConfirmation => :packages)
84
+ Procedures::Packages::Update => :packages)
89
85
  context.map(:assumeyes,
90
86
  Procedures::Packages::Update => :assumeyes)
91
87
  end
@@ -77,7 +77,7 @@ def exclude_hook(conduit):
77
77
  else:
78
78
  suffix = ''
79
79
  conduit.info(1, '\n'
80
- 'WARNING: Excluding %d package%s due to foreman-protector. \n'
80
+ 'WARNING: Excluding %d update%s due to foreman-protector. \n'
81
81
  'Use foreman-maintain packages install/update <package> \n'
82
82
  'to safely install packages without restrictions.\n'
83
83
  'Use foreman-maintain upgrade run for full upgrade.\n'