foreman_maintain 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/features/foreman_database.rb +1 -1
- data/definitions/features/gofer.rb +3 -1
- data/definitions/features/hammer.rb +17 -11
- data/definitions/procedures/restore/installer_reset.rb +1 -2
- data/lib/foreman_maintain/cli/packages_command.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f43b5ceb85f627566ba0e4708b3bce0875b26a010afdb438c6be123d8f1e6a
|
4
|
+
data.tar.gz: 47e5d5c3f486a5f6b574c76370282d31fd6e162245f5bc627959ff043ba6b680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1578cc9f64f72126971145298d0ac44949cc254a422511c08e972078f066a88024c5b3400f78756c6a1bf7955e2e2a7bcd24977318a6f2d9a126a28739fa8c08
|
7
|
+
data.tar.gz: a2294861d717873c98a454b83a293402a617bea6aa7f9a44968417eeca6072eee30fa1088c15d0df18853a6cd9c06b73b5638783d9379ad30ec30498eeec5941
|
@@ -16,7 +16,7 @@ class Features::ForemanDatabase < ForemanMaintain::Feature
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def config_files
|
19
|
-
if check_min_version('foreman', '2.0')
|
19
|
+
if el7? && check_min_version('foreman', '2.0')
|
20
20
|
['/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf']
|
21
21
|
else
|
22
22
|
['/var/lib/pgsql/data/postgresql.conf']
|
@@ -3,7 +3,9 @@ class Features::Gofer < ForemanMaintain::Feature
|
|
3
3
|
label :gofer
|
4
4
|
|
5
5
|
confine do
|
6
|
-
find_package('gofer')
|
6
|
+
find_package('gofer') &&
|
7
|
+
ForemanMaintain::Utils::Service::Systemd.new('goferd', 0).exist? &&
|
8
|
+
ForemanMaintain::Utils::Service::Systemd.new('goferd', 0).enabled?
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
@@ -27,6 +27,7 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
27
27
|
|
28
28
|
def setup_admin_access
|
29
29
|
return true if check_connection
|
30
|
+
|
30
31
|
logger.info('Hammer setup is not valid. Fixing configuration.')
|
31
32
|
custom_config = { :foreman => { :username => username } }
|
32
33
|
custom_config = on_invalid_host(custom_config)
|
@@ -42,8 +43,8 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
42
43
|
@ready
|
43
44
|
end
|
44
45
|
|
45
|
-
def check_connection
|
46
|
-
@ready = _check_connection
|
46
|
+
def check_connection(config = {})
|
47
|
+
@ready = _check_connection(config)
|
47
48
|
end
|
48
49
|
|
49
50
|
def server_uri
|
@@ -55,8 +56,11 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
55
56
|
File.join(fm_config_dir, 'foreman-maintain-hammer.yml')
|
56
57
|
end
|
57
58
|
|
58
|
-
def command_base
|
59
|
-
if
|
59
|
+
def command_base(config = {})
|
60
|
+
if !config.empty?
|
61
|
+
%(RUBYOPT='-W0' LANG=en_US.utf-8 hammer --username "#{config[:foreman][:username]}" \
|
62
|
+
--password "#{config[:foreman][:password]}" --interactive=no)
|
63
|
+
elsif File.exist?(custom_config_file)
|
60
64
|
%(RUBYOPT='-W0' LANG=en_US.utf-8 hammer -c "#{custom_config_file}" --interactive=no)
|
61
65
|
else
|
62
66
|
%(RUBYOPT='-W0' LANG=en_US.utf-8 hammer --interactive=no)
|
@@ -100,9 +104,7 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
100
104
|
|
101
105
|
def config_error
|
102
106
|
raise ForemanMaintain::HammerConfigurationError, 'Hammer configuration failed: '\
|
103
|
-
|
104
|
-
" #{custom_config_file} correct?\n" \
|
105
|
-
'Is the server down?'
|
107
|
+
"Incorrect credential for #{username} user."
|
106
108
|
end
|
107
109
|
|
108
110
|
def on_missing_password(custom_config)
|
@@ -131,6 +133,7 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
131
133
|
config_directories.reverse.each do |path|
|
132
134
|
full_path = File.expand_path path
|
133
135
|
next unless File.directory? full_path
|
136
|
+
|
134
137
|
load_from_file(File.join(full_path, 'cli_config.yml'))
|
135
138
|
load_from_file(File.join(full_path, 'defaults.yml'))
|
136
139
|
# load config for modules
|
@@ -152,25 +155,28 @@ class Features::Hammer < ForemanMaintain::Feature
|
|
152
155
|
|
153
156
|
def username
|
154
157
|
return 'admin' unless feature(:installer)
|
158
|
+
|
155
159
|
feature(:installer).initial_admin_username
|
156
160
|
end
|
157
161
|
|
158
162
|
def password_from_answers(config_username)
|
159
163
|
return nil unless feature(:installer)
|
160
164
|
return nil unless config_username == feature(:installer).initial_admin_username
|
165
|
+
|
161
166
|
feature(:installer).initial_admin_password
|
162
167
|
end
|
163
168
|
|
164
169
|
def save_config_and_check(config)
|
165
|
-
|
166
|
-
|
170
|
+
config[:foreman][:password] ? check_connection(config) : check_connection
|
171
|
+
save_config(config) if ready?
|
167
172
|
end
|
168
173
|
|
169
174
|
def save_config(config)
|
170
175
|
File.open(custom_config_file, 'w', 0o600) { |f| f.puts YAML.dump(config) }
|
171
176
|
end
|
172
177
|
|
173
|
-
def _check_connection
|
174
|
-
|
178
|
+
def _check_connection(config = {})
|
179
|
+
cmd = "#{command_base(config)} user list --per-page 1 2>&1"
|
180
|
+
`#{cmd}` && $CHILD_STATUS.exitstatus == 0
|
175
181
|
end
|
176
182
|
end
|
@@ -21,8 +21,7 @@ module Procedures::Restore
|
|
21
21
|
# already ran since this is to be run on an existing system, which means installer checks
|
22
22
|
# has already been skipped
|
23
23
|
if feature(:foreman_proxy) &&
|
24
|
-
feature(:foreman_proxy).with_content?
|
25
|
-
check_min_version('katello-installer-base', '3.2.0')
|
24
|
+
feature(:foreman_proxy).with_content?
|
26
25
|
installer << '--disable-system-checks '
|
27
26
|
end
|
28
27
|
installer
|
@@ -58,7 +58,7 @@ module ForemanMaintain
|
|
58
58
|
end
|
59
59
|
|
60
60
|
subcommand 'is-locked', 'Check if update of packages is allowed' do
|
61
|
-
interactive_option([])
|
61
|
+
interactive_option(['assumeyes'])
|
62
62
|
def execute
|
63
63
|
locked = ForemanMaintain.package_manager.versions_locked?
|
64
64
|
puts "Packages are#{locked ? '' : ' not'} locked"
|
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.
|
4
|
+
version: 0.8.8
|
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-07-
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|