foreman_maintain 1.0.13 → 1.0.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6b379bdb79107fc7f416af7bf700834ec7ae0591b734926398a09311d86879e
4
- data.tar.gz: bf901e325a757e8e5c31787019dd9ba662bedef4a5692f20d78f4204f45bbcc4
3
+ metadata.gz: 0daf3332063c9ae83f36cd69d2ddd6608ac10fd14b2cb0c2391210ddd332af80
4
+ data.tar.gz: 68fcc2ea5a4196afe431ebebec41a66e9c6ed72bf9f7f7e9f123993139dc7257
5
5
  SHA512:
6
- metadata.gz: 49831252dbbb12f0dc9f6e591d24aa9cb112e9dacfe50470c5ef9cb1a5c6a4f5e7070b95a0929f970dfcb7430ffad4cffce74f6cbd1c8f28231e26411cc42886
7
- data.tar.gz: e0173b351c72f65b1d17cca48c31a7b3896781c8a2af6d07a23c25593318ed1f548f73a54e8ece99b8ced0ff6fb0828f6d850bde95a9de07950c03a433861987
6
+ metadata.gz: 8e4ad682218a2efdaf3e205974db79ada30359f37aaca377d4485fe474bc0bda9080692890753dec1bd6ed8bd176c7a48a5646be2d77c362bab1f4072f7e5f43
7
+ data.tar.gz: a9ba1078902c5061bc5f1900dbfec456b1eadcdf13c986efb1bea6a0cd1daa12c06b9dfc6310d3e67dfc1c256fee39d57aabdda58ae899b29729b738fbc7bfe5
@@ -24,7 +24,15 @@ module Procedures::Pulp
24
24
  '/var/lib/pulp/uploads',
25
25
  '/var/lib/mongodb/',
26
26
  '/var/cache/pulp'
27
- ]
27
+ ].select { |dir| File.directory?(dir) }
28
+ end
29
+
30
+ def pulp_data_dirs_mountpoints
31
+ pulp_data_dirs.select { |d| Pathname(d).mountpoint? }
32
+ end
33
+
34
+ def deletable_pulp_dirs
35
+ @deletable_pulp_dirs ||= pulp_data_dirs - pulp_data_dirs_mountpoints
28
36
  end
29
37
 
30
38
  # rubocop:disable Metrics/MethodLength
@@ -53,11 +61,12 @@ module Procedures::Pulp
53
61
  @installed_pulp_packages
54
62
  end
55
63
 
56
- def data_dir_removal_cmds
57
- pulp_data_dirs.select { |dir| File.directory?(dir) }.map { |dir| "rm -rf #{dir}" }
64
+ def data_dir_removal_cmds(pulp_dirs)
65
+ pulp_dirs.map { |dir| "rm -rf #{dir}" }
58
66
  end
59
67
 
60
- def ask_to_proceed(rm_cmds)
68
+ def ask_to_proceed
69
+ rm_cmds = data_dir_removal_cmds(pulp_data_dirs)
61
70
  question = "\nWARNING: All pulp2 packages will be removed with the following commands:\n"
62
71
  question += "\n# rpm -e #{pulp_packages.join(' ')}" if pulp_packages.any?
63
72
  question += "\n# yum remove rh-mongodb34-*"
@@ -70,11 +79,9 @@ module Procedures::Pulp
70
79
  end
71
80
 
72
81
  def run
73
- rm_cmds = data_dir_removal_cmds
74
-
75
82
  assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
76
83
 
77
- ask_to_proceed(rm_cmds) unless assumeyes_val
84
+ ask_to_proceed unless assumeyes_val
78
85
 
79
86
  remove_pulp if pulp_packages.any?
80
87
 
@@ -86,7 +93,7 @@ module Procedures::Pulp
86
93
 
87
94
  drop_migrations
88
95
 
89
- delete_pulp_data(rm_cmds) if rm_cmds.any?
96
+ delete_pulp_data
90
97
 
91
98
  restart_pulpcore_services
92
99
  end
@@ -163,12 +170,41 @@ module Procedures::Pulp
163
170
  end
164
171
  # rubocop:enable Metrics/BlockLength
165
172
 
166
- def delete_pulp_data(rm_cmds)
167
- with_spinner('Deleting pulp2 data directories') do |spinner|
168
- rm_cmds.each do |cmd|
169
- execute!(cmd)
173
+ def delete_pulp_data
174
+ non_mountpoints = data_dir_removal_cmds(deletable_pulp_dirs)
175
+ mountpoints = pulp_data_dirs_mountpoints
176
+ with_spinner('') do |spinner|
177
+ if non_mountpoints.any?
178
+ spinner.update('Deleting pulp2 data directories.')
179
+ non_mountpoints.each do |cmd|
180
+ execute!(cmd)
181
+ end
182
+ msg_for_del_non_mountpoints(mountpoints, spinner)
183
+ end
184
+ if mountpoints.any?
185
+ msg_for_del_mountpoints(mountpoints, spinner)
170
186
  end
171
- spinner.update('Done deleting pulp2 data directories')
187
+ end
188
+ end
189
+
190
+ def msg_for_del_non_mountpoints(mountpoints, spinner)
191
+ if mountpoints.empty?
192
+ spinner.update('Done deleting all pulp2 data directories.')
193
+ else
194
+ spinner.update("Deleted: #{deletable_pulp_dirs.join("\n")}")
195
+ end
196
+ end
197
+
198
+ def msg_for_del_mountpoints(mountpoints, spinner)
199
+ _, cmd_name = ForemanMaintain.pkg_and_cmd_name
200
+ if mountpoints.count > 1
201
+ spinner.update("The directories #{mountpoints.join(',')} are individual mountpoints.")
202
+ puts "\nThe #{cmd_name} won't delete these directories.\n"\
203
+ 'You need to remove content and these directories on your own.'
204
+ else
205
+ spinner.update("The directory #{mountpoints.join(',')} is individual mountpoint.")
206
+ puts "\nThe #{cmd_name} won't delete the directory.\n"\
207
+ 'You need to remove content and the directory on your own.'
172
208
  end
173
209
  end
174
210
 
@@ -43,7 +43,11 @@ module ForemanMaintain::Scenarios
43
43
  end
44
44
 
45
45
  def req_repos_to_update_pkgs
46
- main_rh_repos + [maintenance_repo_id(target_version)]
46
+ if use_rhsm?
47
+ main_rh_repos + [maintenance_repo_id(target_version)]
48
+ else
49
+ [maintenance_repo_id(target_version)]
50
+ end
47
51
  end
48
52
  end
49
53
 
@@ -40,6 +40,7 @@ module Scenarios::Capsule_6_11
40
40
  def compose
41
41
  add_steps(find_procedures(:pre_migrations))
42
42
  add_step(Procedures::Pulp::Remove.new(:assumeyes => true))
43
+ add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
43
44
  add_step(Procedures::Service::Stop.new)
44
45
  end
45
46
  end
@@ -39,6 +39,7 @@ module Scenarios::Capsule_6_11_z
39
39
 
40
40
  def compose
41
41
  add_steps(find_procedures(:pre_migrations))
42
+ add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
42
43
  add_step(Procedures::Service::Stop.new)
43
44
  end
44
45
  end
@@ -42,6 +42,7 @@ module Scenarios::Satellite_6_11
42
42
  def compose
43
43
  add_steps(find_procedures(:pre_migrations))
44
44
  add_step(Procedures::Pulp::Remove.new(:assumeyes => true))
45
+ add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
45
46
  add_step(Procedures::Service::Stop.new)
46
47
  end
47
48
  end
@@ -39,6 +39,7 @@ module Scenarios::Satellite_6_11_z
39
39
 
40
40
  def compose
41
41
  add_steps(find_procedures(:pre_migrations))
42
+ add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
42
43
  add_step(Procedures::Service::Stop.new)
43
44
  end
44
45
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.0.13'.freeze
2
+ VERSION = '1.0.16'.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.0.13
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -453,7 +453,7 @@ homepage: https://github.com/theforeman/foreman_maintain
453
453
  licenses:
454
454
  - GPL-3.0
455
455
  metadata: {}
456
- post_install_message:
456
+ post_install_message:
457
457
  rdoc_options: []
458
458
  require_paths:
459
459
  - lib
@@ -468,8 +468,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
468
  - !ruby/object:Gem::Version
469
469
  version: '0'
470
470
  requirements: []
471
- rubygems_version: 3.0.9
472
- signing_key:
471
+ rubygems_version: 3.3.7
472
+ signing_key:
473
473
  specification_version: 4
474
474
  summary: Foreman maintenance tool belt
475
475
  test_files: []