foreman_maintain 0.2.3 → 0.2.4
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 +4 -4
- data/definitions/features/candlepin_database.rb +34 -4
- data/definitions/features/service.rb +6 -1
- data/definitions/scenarios/upgrade_to_satellite_6_4.rb +1 -1
- data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +0 -1
- data/lib/foreman_maintain/upgrade_runner.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999cf43419721ea21acfe4f43ed88dde3d41633b
|
4
|
+
data.tar.gz: 1864e1f18ff5c036f25516d52ab7cdcee87b64fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17e48dc3ff9981b09d2265e427ebd6dc635e28e75f8f37b9c8d5d43974cc3df90cfdab9b7e585af8def025c06a736fc277d8fe2143ac8b91a8174e6c5c5b8f5d
|
7
|
+
data.tar.gz: 3b5dce2b1b7754e45c509ac032e8cfe3b511c72c51fdcf4d201cc42bb116842144250eef48f7da1b73da3c1e2ec2f238e47cab74d33292976327cf636a7d22a1
|
@@ -21,7 +21,7 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
21
21
|
|
22
22
|
def check_option_using_cpdb_help(option_name, parent_cmd = '')
|
23
23
|
parent_cmd = '/usr/share/candlepin/cpdb' if parent_cmd.empty?
|
24
|
-
help_cmd = "#{parent_cmd} --help | grep -c '\\-\\-#{option_name}
|
24
|
+
help_cmd = "#{parent_cmd} --help | grep -c '\\-\\-#{option_name}'"
|
25
25
|
execute?(help_cmd)
|
26
26
|
end
|
27
27
|
|
@@ -31,6 +31,7 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
31
31
|
main_cmd += format_shell_args(
|
32
32
|
'-u' => configuration['username'], '-p' => configuration[%(password)]
|
33
33
|
)
|
34
|
+
main_cmd += format_shell_args(extend_with_db_options)
|
34
35
|
execute_with_status(main_cmd, :hidden_patterns => [configuration['password']])
|
35
36
|
end
|
36
37
|
|
@@ -45,22 +46,51 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
45
46
|
|
46
47
|
private
|
47
48
|
|
49
|
+
# rubocop:disable Metrics/MethodLength
|
48
50
|
def load_configuration
|
49
51
|
raw_config = File.read(CANDLEPIN_DB_CONFIG)
|
50
52
|
full_config = Hash[raw_config.scan(/(^[^#\n][^=]*)=(.*)/)]
|
51
53
|
uri_regexp = %r{://(([^/:]*):?([^/]*))/([^?]*)\??(ssl=([^&]*))?}
|
52
|
-
|
54
|
+
url = full_config['jpa.config.hibernate.connection.url']
|
55
|
+
uri = uri_regexp.match(url)
|
53
56
|
@configuration = {
|
54
57
|
'username' => full_config['jpa.config.hibernate.connection.username'],
|
55
58
|
'password' => full_config['jpa.config.hibernate.connection.password'],
|
56
59
|
'database' => uri[4],
|
57
60
|
'host' => uri[2],
|
58
61
|
'port' => uri[3] || '5432',
|
59
|
-
'ssl' => (
|
62
|
+
'ssl' => (fetch_extra_param(url, 'ssl') == 'true'),
|
63
|
+
'sslfactory' => fetch_extra_param(url, 'sslfactory'),
|
60
64
|
'driver_class' => full_config['jpa.config.hibernate.connection.driver_class'],
|
61
|
-
'url' =>
|
65
|
+
'url' => url
|
62
66
|
}
|
63
67
|
end
|
68
|
+
# rubocop:enable Metrics/MethodLength
|
69
|
+
|
70
|
+
def extend_with_db_options
|
71
|
+
db_options = { '-d' => construct_database_string }
|
72
|
+
if check_option_using_cpdb_help('dbhost')
|
73
|
+
db_options['--dbhost'] = configuration['host']
|
74
|
+
db_options['--dbport'] = configuration['port']
|
75
|
+
end
|
76
|
+
db_options
|
77
|
+
end
|
78
|
+
|
79
|
+
def construct_database_string
|
80
|
+
db_str = configuration['database']
|
81
|
+
extra_opts = []
|
82
|
+
extra_opts << "ssl=#{configuration['ssl']}" if configuration['ssl']
|
83
|
+
extra_opts << "sslfactory=#{configuration['sslfactory']}" if configuration['sslfactory']
|
84
|
+
db_str += "?#{extra_opts.join('&')}" unless extra_opts.empty?
|
85
|
+
db_str
|
86
|
+
end
|
87
|
+
|
88
|
+
def fetch_extra_param(url, key_name)
|
89
|
+
query_string = url.split('?')[1]
|
90
|
+
return nil unless query_string
|
91
|
+
output = /#{key_name}=([^&]*)?/.match(query_string)
|
92
|
+
output[1] if output
|
93
|
+
end
|
64
94
|
|
65
95
|
def cpdb_validate_cmd
|
66
96
|
return '' unless check_option_using_cpdb_help('validate')
|
@@ -35,7 +35,12 @@ class Features::Service < ForemanMaintain::Feature
|
|
35
35
|
|
36
36
|
def existing_services
|
37
37
|
service_list = get_services_from_features(available_features)
|
38
|
-
service_list.select { |service| service_exists?(service) }
|
38
|
+
service_list.select { |service| service_remote?(service) || service_exists?(service) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def service_remote?(service)
|
42
|
+
(service == 'postgresql' && !feature(:instance).postgresql_local?) ||
|
43
|
+
(service == 'mongod' && feature(:instance).database_remote?(:mongo))
|
39
44
|
end
|
40
45
|
|
41
46
|
def filtered_services(options)
|
@@ -21,8 +21,8 @@ module Scenarios::Satellite_6_4
|
|
21
21
|
def compose
|
22
22
|
add_steps(find_checks(:default))
|
23
23
|
add_steps(find_checks(:pre_upgrade))
|
24
|
+
add_steps(find_checks(:puppet_upgrade_guide))
|
24
25
|
add_step(Checks::Repositories::Validate.new(:version => '6.4'))
|
25
|
-
add_step(Checks::Puppet::ProvideUpgradeGuide.new)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
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.2.
|
4
|
+
version: 0.2.4
|
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: 2018-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|