foreman_maintain 0.5.6 → 0.6.0

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.
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
@@ -38,7 +38,7 @@ module ForemanMaintain
38
38
 
39
39
  subcommand 'update', 'Update packages in an unlocked session' do
40
40
  interactive_option
41
- parameter '[PACKAGES ...]', 'packages to update', :attribute_name => :packages
41
+ parameter 'PACKAGES ...', 'packages to update', :attribute_name => :packages
42
42
 
43
43
  def execute
44
44
  run_scenarios_and_exit(
@@ -87,7 +87,8 @@ module ForemanMaintain
87
87
  else
88
88
  "rhel-#{rh_version_major}-server-#{package_name}-#{full_version}-rpms"
89
89
  end
90
- if current_minor_version == '6.3' && full_version.to_s != '6.4' && (
90
+
91
+ if current_minor_version == '6.3' && server_version.to_s != '6.4' && (
91
92
  feature(:puppet_server) && feature(:puppet_server).puppet_version.major == 4)
92
93
  # TODO: confirm repo for capsule. It might be same repo
93
94
  repos << "rhel-#{rh_version_major}-server-satellite-tools-6.3-puppet4-rpms"
@@ -53,10 +53,15 @@ module ForemanMaintain
53
53
  execute?("command -v #{command_name}")
54
54
  end
55
55
 
56
- def execute!(command, options = {})
56
+ def execute_runner(command, options = {})
57
57
  command_runner = Utils::CommandRunner.new(logger, command, options)
58
58
  execution.puts '' if command_runner.interactive? && respond_to?(:execution)
59
59
  command_runner.run
60
+ command_runner
61
+ end
62
+
63
+ def execute!(command, options = {})
64
+ command_runner = execute_runner(command, options)
60
65
  if command_runner.success?
61
66
  command_runner.output
62
67
  else
@@ -65,15 +70,12 @@ module ForemanMaintain
65
70
  end
66
71
 
67
72
  def execute(command, options = {})
68
- command_runner = Utils::CommandRunner.new(logger, command, options)
69
- execution.puts '' if command_runner.interactive? && respond_to?(:execution)
70
- command_runner.run
71
- command_runner.output
73
+ execute_runner(command, options).output
72
74
  end
73
75
 
74
76
  def execute_with_status(command, options = {})
75
- result_msg = execute(command, options)
76
- [$CHILD_STATUS.to_i, result_msg]
77
+ command_runner = execute_runner(command, options)
78
+ [command_runner.exit_status, command_runner.output]
77
79
  end
78
80
 
79
81
  def file_exists?(filename)
@@ -41,9 +41,5 @@ module ForemanMaintain
41
41
  def config_files_to_exclude
42
42
  []
43
43
  end
44
-
45
- def config_files_exclude_for_online
46
- []
47
- end
48
44
  end
49
45
  end
@@ -184,9 +184,9 @@ module ForemanMaintain
184
184
  ask_to_select('Select step to continue', steps, &:runtime_message)
185
185
  end
186
186
 
187
- def ask_decision(message, options = 'y(yes), n(no), q(quit)', ignore_assumeyes: false)
188
- if !ignore_assumeyes && assumeyes?
189
- print("#{message} (assuming yes)\n")
187
+ def ask_decision(message, options = 'y(yes), n(no), q(quit)')
188
+ if assumeyes?
189
+ print("#{message} (assuming yes)")
190
190
  return :yes
191
191
  end
192
192
  until_valid_decision do
@@ -27,7 +27,7 @@ module ForemanMaintain
27
27
  # In fio command, --direct option bypass the cache page
28
28
  def fio
29
29
  cmd = "fio --name=job1 --rw=read --size=1g --output-format=json\
30
- --directory=#{dir} --direct=1 --unlink=1"
30
+ --directory=#{dir} --direct=1"
31
31
  stdout = execute(cmd)
32
32
  output = JSON.parse(stdout)
33
33
  @fio ||= output['jobs'].first['read']['bw'].to_i
@@ -5,7 +5,7 @@ module ForemanMaintain::Utils
5
5
  FACTER_FILES = %w[/usr/bin/facter /opt/puppetlabs/bin/facter].freeze
6
6
 
7
7
  def self.package
8
- puppet_version = version(execute!('/opt/puppetlabs/bin/puppet --version'))
8
+ puppet_version = version(execute!('puppet --version'))
9
9
 
10
10
  puppet_version.major >= 4 ? 'puppet-agent' : 'facter'
11
11
  end
@@ -4,9 +4,10 @@ module ForemanMaintain::Utils
4
4
  include Comparable
5
5
  attr_reader :name, :priority
6
6
 
7
- def initialize(name, priority, _options = {})
7
+ def initialize(name, priority, options = {})
8
8
  @name = name
9
9
  @priority = priority
10
+ @options = options
10
11
  end
11
12
 
12
13
  def <=>(other)
@@ -1,17 +1,26 @@
1
1
  module ForemanMaintain::Utils
2
2
  module Service
3
3
  class Systemd < Abstract
4
- def initialize(name, priority, _options = {})
4
+ def initialize(name, priority, options = {})
5
5
  super
6
6
  @sys = SystemHelpers.new
7
7
  end
8
8
 
9
9
  def command(action, options = {})
10
10
  do_wait = options.fetch(:wait, true) # wait for service to start
11
+ all = @options.fetch(:all, false)
12
+ skip_enablement = @options.fetch(:skip_enablement, false)
13
+
14
+ if skip_enablement && %w[enable disable].include?(action)
15
+ return skip_enablement_message(action, @name)
16
+ end
17
+
11
18
  if do_wait && File.exist?('/usr/sbin/service-wait')
12
19
  "service-wait #{@name} #{action}"
13
20
  else
14
- "systemctl #{action} #{@name}"
21
+ cmd = "systemctl #{action} #{@name}"
22
+ cmd += ' --all' if all
23
+ cmd
15
24
  end
16
25
  end
17
26
 
@@ -53,6 +62,21 @@ module ForemanMaintain::Utils
53
62
  def execute(action, options = {})
54
63
  @sys.execute_with_status(command(action, options))
55
64
  end
65
+
66
+ def skip_enablement_message(action, name)
67
+ # Enable and disable does not work well with globs since they treat them literally.
68
+ # We are skipping the pulpcore-workers@* for these actions until they are configured in
69
+ # a more managable way with systemd
70
+ # rubocop:disable Layout/IndentAssignment
71
+ msg =
72
+ "
73
+ \nWARNING: Skipping #{action} for #{name} as there are a variable amount of services to manage
74
+ and this command will not respond to glob operators. These services have been configured by
75
+ the installer and it is recommended to keep them enabled to prevent misconfiguration.\n
76
+ "
77
+ # rubocop:enable Layout/IndentAssignment
78
+ puts msg
79
+ end
56
80
  end
57
81
  end
58
82
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.5.6'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end