foreman_maintain 0.8.10 → 0.8.11

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: 89971a91002aac54e075713715691d77d7b715b58533f51e3289694cda83aa20
4
- data.tar.gz: 2f0a7a2df838bf960b3ab131600d5845eec38151ef63c0bf3e510da4d207d971
3
+ metadata.gz: a1545da34c13b7d23d4a987c73efd4e49e5b30823f7e9cf7fdc0124488f2e51f
4
+ data.tar.gz: ceb981e4ef8fcfa635194b38b91eab356372f62d66b8d20cd47e1ca42b3140d9
5
5
  SHA512:
6
- metadata.gz: 5234f5d84ff2de5c3857493ab3c52a2f3c7bc03b96f68ba1122d1531ce086937072b7b4d20251ce7716dc81638d64bb95e74331031718c6899b247c3fc7ea561
7
- data.tar.gz: 8ff4f8dfc0e233ef91639e6fbd02d7e74bda85dee490a1e1b7a47aa68d2eade50e5e4f581ca851f6f148b25344959650c78dd2103e1d32be044ba7c170ce4ff5
6
+ metadata.gz: cbfe9d38c82fcdb7ee303fd2994e490174fbf7abb7ab454057f7d0118b18e77a3c6fe9633d1ef88d4846e515fb4a2f60060ffafc0ea92b10ee119b8a185f5292
7
+ data.tar.gz: 5e966342075c528158d2581c3550ea2ea9df66f57a4cad96307d563f395a39b31f6a39bd5257959aa884d9a4749045b0286cd6e8bd07f902853c49557566275d
@@ -6,7 +6,7 @@ module Checks::RemoteExecution
6
6
  confine do
7
7
  feature(:instance).downstream &&
8
8
  feature(:instance).downstream.current_minor_version == '6.2' &&
9
- find_package('tfm-rubygem-smart_proxy_dynflow_core') &&
9
+ find_package(proxy_plugin_name('dynflow_core')) &&
10
10
  file_exists?('/etc/smart_proxy_dynflow_core')
11
11
  end
12
12
  end
@@ -3,7 +3,7 @@ class Features::ForemanCockpit < ForemanMaintain::Feature
3
3
  label :foreman_cockpit
4
4
 
5
5
  confine do
6
- server? && find_package('tfm-rubygem-foreman_remote_execution-cockpit')
6
+ server? && find_package(foreman_plugin_name('foreman_remote_execution-cockpit'))
7
7
  end
8
8
  end
9
9
 
@@ -16,11 +16,11 @@ class Features::ForemanDatabase < ForemanMaintain::Feature
16
16
  end
17
17
 
18
18
  def config_files
19
- if el7? && check_min_version('foreman', '2.0')
20
- ['/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf']
21
- else
22
- ['/var/lib/pgsql/data/postgresql.conf']
23
- end
19
+ [postgresql_conf]
20
+ end
21
+
22
+ def postgresql_conf
23
+ "#{data_dir}/postgresql.conf"
24
24
  end
25
25
 
26
26
  def services
@@ -3,7 +3,7 @@ class Features::ForemanOpenscap < ForemanMaintain::Feature
3
3
  label :foreman_openscap
4
4
 
5
5
  confine do
6
- check_min_version('tfm-rubygem-foreman_openscap', '0.5.3')
6
+ find_package(foreman_plugin_name('foreman_openscap'))
7
7
  end
8
8
  end
9
9
 
@@ -23,8 +23,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
23
23
  label :foreman_tasks
24
24
 
25
25
  confine do
26
- check_min_version('ruby193-rubygem-foreman-tasks', '0.6') ||
27
- check_min_version('tfm-rubygem-foreman-tasks', '0.7')
26
+ find_package(foreman_plugin_name('foreman-tasks'))
28
27
  end
29
28
  end
30
29
 
@@ -6,8 +6,7 @@ class Features::Hammer < ForemanMaintain::Feature
6
6
  metadata do
7
7
  label :hammer
8
8
  confine do
9
- # FIXME: How does this run on proxy?
10
- find_package('rubygem-hammer_cli') || find_package('tfm-rubygem-hammer_cli')
9
+ find_package(hammer_package)
11
10
  end
12
11
  end
13
12
 
@@ -1,11 +1,14 @@
1
1
  class Features::Pulp < ForemanMaintain::Feature
2
2
  include ForemanMaintain::Concerns::DirectoryMarker
3
+ include ForemanMaintain::Concerns::PulpCommon
3
4
 
4
5
  metadata do
5
6
  label :pulp2
6
7
 
7
8
  confine do
8
- find_package('pulp-server') && !check_min_version('katello-common', '4.0')
9
+ !check_min_version('katello-common', '4.0') &&
10
+ ForemanMaintain::Utils::Service::Systemd.new('pulp_resource_manager', 0).exist? &&
11
+ ForemanMaintain::Utils::Service::Systemd.new('pulp_resource_manager', 0).enabled?
9
12
  end
10
13
  end
11
14
 
@@ -22,10 +25,6 @@ class Features::Pulp < ForemanMaintain::Feature
22
25
  ]
23
26
  end
24
27
 
25
- def data_dir
26
- '/var/lib/pulp'
27
- end
28
-
29
28
  def config_files
30
29
  [
31
30
  '/etc/pki/pulp',
@@ -34,10 +33,4 @@ class Features::Pulp < ForemanMaintain::Feature
34
33
  '/etc/default/pulp_workers'
35
34
  ]
36
35
  end
37
-
38
- def exclude_from_backup
39
- # Exclude /var/lib/pulp/katello-export and /var/lib/pulp/cache
40
- # since the tar is run from /var/lib/pulp, list subdir paths only
41
- ['katello-export', 'cache']
42
- end
43
36
  end
@@ -11,10 +11,8 @@ class Features::Pulpcore < ForemanMaintain::Feature
11
11
  end
12
12
 
13
13
  def services
14
- self.class.pulpcore_common_services + configured_workers + [
15
- system_service('rh-redis5-redis', 5),
16
- system_service('httpd', 30)
17
- ]
14
+ self.class.pulpcore_common_services + configured_workers +
15
+ feature(:redis).services + feature(:apache).services
18
16
  end
19
17
 
20
18
  def configured_workers
@@ -2,12 +2,14 @@ class Features::PulpcoreDatabase < ForemanMaintain::Feature
2
2
  PULPCORE_DB_CONFIG = '/etc/pulp/settings.py'.freeze
3
3
 
4
4
  include ForemanMaintain::Concerns::BaseDatabase
5
+ include ForemanMaintain::Concerns::DirectoryMarker
6
+ include ForemanMaintain::Concerns::PulpCommon
5
7
 
6
8
  metadata do
7
9
  label :pulpcore_database
8
10
 
9
11
  confine do
10
- file_nonzero?(PULPCORE_DB_CONFIG)
12
+ file_nonzero?(PULPCORE_DB_CONFIG) && check_min_version('katello-common', '3.18')
11
13
  end
12
14
  end
13
15
 
@@ -9,7 +9,7 @@ class Features::Redis < ForemanMaintain::Feature
9
9
  end
10
10
 
11
11
  def services
12
- [system_service(self.class.service_name, 10)]
12
+ [system_service(self.class.service_name, 5)]
13
13
  end
14
14
 
15
15
  def config_files
@@ -20,11 +20,17 @@ class Features::Redis < ForemanMaintain::Feature
20
20
  SCL_NAME = 'rh-redis5'.freeze
21
21
 
22
22
  def etc_prefix
23
- "/etc/opt/rh/#{SCL_NAME}"
23
+ if el7?
24
+ "/etc/opt/rh/#{SCL_NAME}"
25
+ else
26
+ '/etc'
27
+ end
24
28
  end
25
29
 
26
30
  def scl_prefix
27
- "#{SCL_NAME}-"
31
+ if el7?
32
+ "#{SCL_NAME}-"
33
+ end
28
34
  end
29
35
 
30
36
  def service_name
@@ -3,12 +3,15 @@ module Procedures::Backup
3
3
  metadata do
4
4
  description 'Backup Pulp data'
5
5
  tags :backup
6
- for_feature :pulp2
7
6
  param :backup_dir, 'Directory where to backup to', :required => true
8
7
  param :tar_volume_size, 'Size of tar volume (indicates splitting)'
9
8
  param :ensure_unchanged, 'Ensure the data did not change during backup'
10
9
  param :skip, 'Skip Pulp content during backup'
11
10
  param :mount_dir, 'Snapshot mount directory'
11
+
12
+ confine do
13
+ feature(:pulp2) || feature(:pulpcore_database)
14
+ end
12
15
  end
13
16
 
14
17
  def run
@@ -26,11 +29,15 @@ module Procedures::Backup
26
29
 
27
30
  private
28
31
 
32
+ def any_pulp_feature
33
+ feature(:pulp2) || feature(:pulpcore_database)
34
+ end
35
+
29
36
  def pulp_backup
30
37
  feature(:tar).run(
31
38
  :archive => File.join(@backup_dir, 'pulp_data.tar'),
32
39
  :command => 'create',
33
- :exclude => feature(:pulp2).exclude_from_backup,
40
+ :exclude => any_pulp_feature.exclude_from_backup,
34
41
  :listed_incremental => File.join(@backup_dir, '.pulp.snar'),
35
42
  :transform => 's,^,var/lib/pulp/,S',
36
43
  :volume_size => @tar_volume_size,
@@ -39,9 +46,10 @@ module Procedures::Backup
39
46
  end
40
47
 
41
48
  def pulp_dir
42
- return feature(:pulp2).data_dir if @mount_dir.nil?
49
+ return any_pulp_feature.pulp_data_dir if @mount_dir.nil?
50
+
43
51
  mount_point = File.join(@mount_dir, 'pulp')
44
- dir = feature(:pulp2).find_marked_directory(mount_point)
52
+ dir = any_pulp_feature.find_marked_directory(mount_point)
45
53
  unless dir
46
54
  raise ForemanMaintain::Error::Fail,
47
55
  "Pulp base directory not found in the mount point (#{mount_point})"
@@ -5,22 +5,28 @@ module Procedures::Backup
5
5
  metadata do
6
6
  description 'Create and mount snapshot of Pulp data'
7
7
  tags :backup
8
- for_feature :pulp2
9
8
  MountBase.common_params(self)
10
9
  param :skip, 'Skip Pulp content during backup'
10
+ confine do
11
+ feature(:pulp2) || feature(:pulpcore_database)
12
+ end
11
13
  end
12
14
 
13
15
  def run
14
16
  skip if @skip
15
17
  with_spinner('Creating snapshot of Pulp') do |spinner|
16
- feature(:pulp2).with_marked_directory(feature(:pulp2).data_dir) do
17
- lv_info = get_lv_info(feature(:pulp2).data_dir)
18
+ current_pulp_feature.with_marked_directory(current_pulp_feature.data_dir) do
19
+ lv_info = get_lv_info(current_pulp_feature.data_dir)
18
20
  create_lv_snapshot('pulp-snap', @block_size, lv_info[0])
19
21
  spinner.update("Mounting snapshot of Pulp on #{mount_location('pulp')}")
20
22
  mount_snapshot('pulp', lv_info[1])
21
23
  end
22
24
  end
23
25
  end
26
+
27
+ def current_pulp_feature
28
+ feature(:pulp2) || feature(:pulpcore_database)
29
+ end
24
30
  end
25
31
  end
26
32
  end
@@ -3,16 +3,14 @@ module Procedures::ForemanDocker
3
3
  metadata do
4
4
  advanced_run false
5
5
  description 'Drop foreman_docker plugin'
6
- end
7
-
8
- def docker_package
9
- 'tfm-rubygem-foreman_docker'
6
+ confine do
7
+ find_package(foreman_plugin_name('foreman_docker'))
8
+ end
10
9
  end
11
10
 
12
11
  def run
13
- return unless execute?("rpm -q #{docker_package}")
14
12
  execute!('foreman-rake foreman_docker:cleanup')
15
- packages_action(:remove, [docker_package], :assumeyes => true)
13
+ packages_action(:remove, foreman_plugin_name('foreman_docker'), :assumeyes => true)
16
14
  end
17
15
  end
18
16
  end
@@ -63,9 +63,12 @@ module Procedures::Restore
63
63
  def extract_pgsql_data(backup)
64
64
  pgsql_data_tar = base_tar.merge(
65
65
  :archive => backup.file_map[:pgsql_data][:path],
66
- :gzip => true
66
+ :gzip => true,
67
+ :transform => feature(:foreman_database).restore_transform
67
68
  )
68
69
  feature(:tar).run(pgsql_data_tar)
70
+ # workaround for https://tickets.puppetlabs.com/browse/MODULES-11160
71
+ execute("sed -i '/data_directory/d' #{feature(:foreman_database).postgresql_conf}")
69
72
  end
70
73
  end
71
74
  end
@@ -2,13 +2,20 @@ module ForemanMaintain
2
2
  module Concerns
3
3
  module BaseDatabase
4
4
  def data_dir
5
- if el7? && check_min_version('foreman', '2.0')
5
+ if el7? && package_manager.installed?('rh-postgresql12-postgresql-server-syspaths')
6
6
  '/var/opt/rh/rh-postgresql12/lib/pgsql/data/'
7
7
  else
8
8
  '/var/lib/pgsql/data/'
9
9
  end
10
10
  end
11
11
 
12
+ def restore_transform
13
+ if el8?
14
+ # this allows to transform an EL7 backup to EL8 paths
15
+ 's,^var/opt/rh/rh-postgresql12/,var/,S'
16
+ end
17
+ end
18
+
12
19
  def configuration
13
20
  raise NotImplementedError
14
21
  end
@@ -0,0 +1,22 @@
1
+ module ForemanMaintain
2
+ module Concerns
3
+ module PulpCommon
4
+ def pulp_data_dir
5
+ '/var/lib/pulp'
6
+ end
7
+
8
+ def exclude_from_backup
9
+ # For pulp2:
10
+ # Exclude /var/lib/pulp/katello-export and /var/lib/pulp/cache
11
+ # since the tar is run from /var/lib/pulp, list subdir paths only
12
+ # For pulp3/pulpcore:
13
+ pulp2_dirs = %w[katello-export cache]
14
+ # For pulp3/pulpcore:
15
+ # Only need to backup media directory of /var/lib/pulp
16
+ # All below directories and their contents are regenerated on installer run
17
+ pulpcore_dirs = %w[assets exports imports sync_imports tmp]
18
+ pulp2_dirs + pulpcore_dirs
19
+ end
20
+ end
21
+ end
22
+ end
@@ -184,15 +184,6 @@ module ForemanMaintain
184
184
  ForemanMaintain.package_manager
185
185
  end
186
186
 
187
- private
188
-
189
- def check_version(name)
190
- current_version = package_version(name)
191
- if current_version
192
- yield current_version
193
- end
194
- end
195
-
196
187
  def os_facts
197
188
  facter = ForemanMaintain::Utils::Facter.path
198
189
  @os_facts ||= JSON.parse(execute("#{facter} -j os"))
@@ -217,6 +208,52 @@ module ForemanMaintain
217
208
  def el_major_version
218
209
  return os_facts['os']['release']['major'] if el?
219
210
  end
211
+
212
+ def ruby_prefix(scl = true)
213
+ if el7? && scl
214
+ 'tfm-rubygem-'
215
+ elsif el7? || el8?
216
+ 'rubygem-'
217
+ elsif debian?
218
+ 'ruby-'
219
+ end
220
+ end
221
+
222
+ def foreman_plugin_name(plugin)
223
+ if debian?
224
+ plugin.tr!('_', '-')
225
+ end
226
+ ruby_prefix + plugin
227
+ end
228
+
229
+ def proxy_plugin_name(plugin)
230
+ if debian?
231
+ plugin.tr!('_', '-')
232
+ proxy_plugin_prefix = 'smart-proxy-'
233
+ else
234
+ proxy_plugin_prefix = 'smart_proxy_'
235
+ end
236
+ scl = check_min_version('foreman-proxy', '2.0')
237
+ ruby_prefix(scl) + proxy_plugin_prefix + plugin
238
+ end
239
+
240
+ def hammer_package
241
+ hammer_prefix = if debian?
242
+ 'hammer-cli'
243
+ else
244
+ 'hammer_cli'
245
+ end
246
+ ruby_prefix + hammer_prefix
247
+ end
248
+
249
+ private
250
+
251
+ def check_version(name)
252
+ current_version = package_version(name)
253
+ if current_version
254
+ yield current_version
255
+ end
256
+ end
220
257
  end
221
258
  end
222
259
  end
@@ -11,20 +11,27 @@ module ForemanMaintain
11
11
  :foreman_online_files, :foreman_offline_files, :fpc_offline_files,
12
12
  :fpc_online_files
13
13
 
14
+ # rubocop:disable Metrics/MethodLength
14
15
  def initialize(backup_dir)
15
16
  # fpc stands for foreman proxy w/ content
16
17
  @backup_dir = backup_dir
17
18
  @standard_files = ['config_files.tar.gz']
18
- @katello_online_files = ['mongo_dump', 'candlepin.dump', 'foreman.dump']
19
- if feature(:pulpcore)
20
- @katello_online_files << 'pulpcore.dump'
21
- end
22
- @katello_offline_files = ['mongo_data.tar.gz', 'pgsql_data.tar.gz']
23
19
  @foreman_online_files = ['foreman.dump']
24
20
  @foreman_offline_files = ['pgsql_data.tar.gz']
25
- @fpc_online_files = ['mongo_dump']
26
- @fpc_offline_files = ['mongo_data.tar.gz']
21
+ @katello_online_files = ['candlepin.dump', 'foreman.dump']
22
+ @katello_offline_files = ['pgsql_data.tar.gz']
23
+ if feature(:pulp2)
24
+ @katello_online_files << 'mongo_dump'
25
+ @katello_offline_files << 'mongo_data.tar.gz'
26
+ @fpc_online_files = ['mongo_dump']
27
+ @fpc_offline_files = ['mongo_data.tar.gz']
28
+ elsif feature(:pulpcore_database)
29
+ @katello_online_files << 'foreman.dump'
30
+ @fpc_online_files = ['pulpcore.dump']
31
+ @fpc_offline_files = ['pgsql_data.tar.gz']
32
+ end
27
33
  end
34
+ # rubocop:enable Metrics/MethodLength
28
35
 
29
36
  def file_map
30
37
  @file_map ||= {
@@ -36,12 +43,9 @@ module ForemanMaintain
36
43
  :mongo_dump => map_file(@backup_dir, 'mongo_dump'),
37
44
  :config_files => map_file(@backup_dir, 'config_files.tar.gz'),
38
45
  :pg_globals => map_file(@backup_dir, 'pg_globals.dump'),
39
- :metadata => map_file(@backup_dir, 'metadata.yml')
46
+ :metadata => map_file(@backup_dir, 'metadata.yml'),
47
+ :pulpcore_dump => map_file(@backup_dir, 'pulpcore.dump')
40
48
  }
41
- if feature(:pulpcore)
42
- @file_map[:pulpcore_dump] = map_file(@backup_dir, 'pulpcore.dump')
43
- end
44
- @file_map
45
49
  end
46
50
 
47
51
  def map_file(backup_dir, filename)
@@ -85,11 +89,6 @@ module ForemanMaintain
85
89
  end
86
90
 
87
91
  def check_file_existence(existence_map)
88
- unless feature(:pulpcore)
89
- existence_map[:present].delete(:pulpcore_dump)
90
- existence_map[:absent].delete(:pulpcore_dump)
91
- end
92
-
93
92
  existence_map[:present].each do |file|
94
93
  unless file_map[file][:present]
95
94
  return false
@@ -107,40 +106,105 @@ module ForemanMaintain
107
106
 
108
107
  # TODO: Need to check for pulpcore feature?
109
108
  def katello_standard_backup?
110
- check_file_existence(:present => [:mongo_data, :pgsql_data],
111
- :absent => [:candlepin_dump, :foreman_dump,
112
- :pulpcore_dump, :mongo_dump])
109
+ present = [:pgsql_data]
110
+ absent = [:candlepin_dump, :foreman_dump, :pulpcore_dump, :mongo_dump]
111
+ if feature(:pulpcore_database) && !feature(:pulp2)
112
+ absent.concat [:mongo_data]
113
+ elsif feature(:pulp2)
114
+ present.concat [:mongo_data]
115
+ else
116
+ return false
117
+ end
118
+ check_file_existence(:present => present,
119
+ :absent => absent)
113
120
  end
114
121
 
115
122
  def katello_online_backup?
116
- check_file_existence(:present => [:candlepin_dump, :foreman_dump,
117
- :pulpcore_dump, :mongo_dump],
118
- :absent => [:mongo_data, :pgsql_data])
123
+ present = [:candlepin_dump, :foreman_dump]
124
+ absent = [:mongo_data, :pgsql_data]
125
+ if feature(:pulpcore_database) && !feature(:pulp2)
126
+ present.concat [:pulpcore_dump]
127
+ absent.concat [:mongo_dump]
128
+ elsif feature(:pulp2) && feature(:pulpcore_database)
129
+ present.concat [:mongo_dump, :pulpcore_dump]
130
+ elsif feature(:pulp2)
131
+ present.concat [:mongo_dump]
132
+ absent.concat [:pulpcore_dump]
133
+ else
134
+ return false
135
+ end
136
+ check_file_existence(:present => present,
137
+ :absent => absent)
119
138
  end
120
139
 
121
140
  def katello_logical_backup?
122
- check_file_existence(:present => [:mongo_dump, :mongo_data, :pgsql_data,
123
- :candlepin_dump, :pulpcore_dump, :foreman_dump],
124
- :absent => [])
141
+ present = [:pgsql_data, :candlepin_dump, :foreman_dump]
142
+ absent = []
143
+ if feature(:pulpcore_database) && !feature(:pulp2)
144
+ present.concat [:pulpcore_dump]
145
+ absent.concat [:mongo_dump, :mongo_data]
146
+ elsif feature(:pulp2) && feature(:pulpcore_database)
147
+ present.concat [:mongo_dump, :mongo_data, :pulpcore_dump]
148
+ elsif feature(:pulp2)
149
+ present.concat [:mongo_dump, :mongo_data]
150
+ absent.concat [:pulpcore_dump]
151
+ else
152
+ return false
153
+ end
154
+ check_file_existence(:present => present,
155
+ :absent => absent)
125
156
  end
126
157
 
127
158
  def fpc_standard_backup?
128
- check_file_existence(:present => [:mongo_data],
129
- :absent => [:pgsql_data, :candlepin_dump,
130
- :foreman_dump, :mongo_dump, :pulpcore_dump])
159
+ present = []
160
+ absent = [:candlepin_dump, :foreman_dump, :pulpcore_dump, :mongo_dump]
161
+ if feature(:pulpcore_database) && !feature(:pulp2)
162
+ present.concat [:pgsql_data]
163
+ absent.concat [:mongo_data]
164
+ elsif feature(:pulp2) && feature(:pulpcore_database)
165
+ present.concat [:mongo_data, :pgsql_data]
166
+ elsif feature(:pulp2)
167
+ present.concat [:mongo_data]
168
+ absent.concat [:pgsql_data]
169
+ else
170
+ return false
171
+ end
172
+ check_file_existence(:present => present,
173
+ :absent => absent)
131
174
  end
132
175
 
133
176
  def fpc_online_backup?
177
+ present = []
134
178
  absent = [:mongo_data, :pgsql_data, :candlepin_dump, :foreman_dump]
135
-
136
- check_file_existence(:present => [:mongo_dump], :absent => absent) ||
137
- check_file_existence(:present => [:pulpcore_dump], :absent => absent)
179
+ if feature(:pulpcore_database) && !feature(:pulp2)
180
+ present.concat [:pulpcore_dump]
181
+ absent.concat [:mongo_dump]
182
+ elsif feature(:pulp2) && feature(:pulpcore_database)
183
+ present.concat [:mongo_dump, :pulpcore_dump]
184
+ elsif feature(:pulp2)
185
+ present.concat [:mongo_dump]
186
+ absent.concat [:pulpcore_dump]
187
+ else
188
+ return false
189
+ end
190
+ check_file_existence(:present => present, :absent => absent)
138
191
  end
139
192
 
140
193
  def fpc_logical_backup?
141
- absent = [:pgsql_data, :candlepin_dump, :foreman_dump]
142
- check_file_existence(:present => [:mongo_dump, :mongo_data], :absent => absent) ||
143
- check_file_existence(:present => [:pulpcore_dump], :absent => absent)
194
+ present = []
195
+ absent = [:candlepin_dump, :foreman_dump]
196
+ if feature(:pulpcore_database) && !feature(:pulp2)
197
+ present.concat [:pulpcore_dump, :pgsql_data]
198
+ absent.concat [:mongo_dump, :mongo_data]
199
+ elsif feature(:pulp2) && feature(:pulpcore_database)
200
+ present.concat [:mongo_dump, :mongo_data, :pulpcore_dump, :pgsql_data]
201
+ elsif feature(:pulp2)
202
+ present.concat [:mongo_dump, :mongo_data]
203
+ absent.concat [:pulpcore_dump, :pgsql_data]
204
+ else
205
+ return false
206
+ end
207
+ check_file_existence(:present => present, :absent => absent)
144
208
  end
145
209
 
146
210
  def foreman_standard_backup?
@@ -152,12 +216,12 @@ module ForemanMaintain
152
216
  def foreman_online_backup?
153
217
  check_file_existence(:present => [:foreman_dump],
154
218
  :absent => [:candlepin_dump, :pgsql_data,
155
- :mongo_data, :mongo_dump])
219
+ :mongo_data, :mongo_dump, :pulpcore_dump])
156
220
  end
157
221
 
158
222
  def foreman_logical_backup?
159
223
  check_file_existence(:present => [:pgsql_data, :foreman_dump],
160
- :absent => [:candlepin_dump, :mongo_data, :mongo_dump])
224
+ :absent => [:candlepin_dump, :mongo_data, :mongo_dump, :pulpcore_dump])
161
225
  end
162
226
 
163
227
  def validate_hostname?
@@ -198,7 +262,7 @@ module ForemanMaintain
198
262
  def sql_dump_files_exist?
199
263
  file_map[:foreman_dump][:present] ||
200
264
  file_map[:candlepin_dump][:present] ||
201
- (feature(:pulpcore) && file_map[:pulpcore_dump][:present])
265
+ (feature(:pulpcore_database) && file_map[:pulpcore_dump][:present])
202
266
  end
203
267
 
204
268
  def incremental?
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.8.10'.freeze
2
+ VERSION = '0.8.11'.freeze
3
3
  end
@@ -22,6 +22,7 @@ module ForemanMaintain
22
22
  require 'foreman_maintain/concerns/directory_marker'
23
23
  require 'foreman_maintain/concerns/downstream'
24
24
  require 'foreman_maintain/concerns/primary_checks'
25
+ require 'foreman_maintain/concerns/pulp_common'
25
26
  require 'foreman_maintain/top_level_modules'
26
27
  require 'foreman_maintain/yaml_storage'
27
28
  require 'foreman_maintain/config'
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: 0.8.10
4
+ version: 0.8.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: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -362,6 +362,7 @@ files:
362
362
  - lib/foreman_maintain/concerns/logger.rb
363
363
  - lib/foreman_maintain/concerns/metadata.rb
364
364
  - lib/foreman_maintain/concerns/primary_checks.rb
365
+ - lib/foreman_maintain/concerns/pulp_common.rb
365
366
  - lib/foreman_maintain/concerns/reporter.rb
366
367
  - lib/foreman_maintain/concerns/scenario_metadata.rb
367
368
  - lib/foreman_maintain/concerns/system_helpers.rb