foreman_maintain 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/definitions/features/foreman_tasks.rb +1 -0
- data/definitions/procedures/packages/update.rb +3 -1
- data/lib/foreman_maintain/concerns/finders.rb +4 -0
- data/lib/foreman_maintain/concerns/system_helpers.rb +9 -7
- data/lib/foreman_maintain/config.rb +2 -2
- data/lib/foreman_maintain/detector.rb +6 -2
- data/lib/foreman_maintain/executable.rb +1 -1
- data/lib/foreman_maintain/scenario.rb +1 -1
- data/lib/foreman_maintain/upgrade_runner.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18fd98c7a843565d1557576d646eed3836b4531d
|
4
|
+
data.tar.gz: 28bf7c63c9992e72d14cc6341aafa4ec77245721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a208375098dcdd9afa2cfe24f0be922933e28b979133f4bf5af5a7f09c54dcb8718f4029bb65bf0982fdffa16b2f644917b0039ba6e3eee274fdad53b90a2d6b
|
7
|
+
data.tar.gz: 8fdd5953b332088338c2b624016b57713733de79a90f1ef88bed936abf1d772ac15458fd7e1949351ccd00fc827b36b432aa523c2c27c282974462e86782e4d9
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@ module Procedures::Packages
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def run
|
9
|
-
|
9
|
+
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
|
10
|
+
clean_all_packages(:assumeyes => assumeyes_val)
|
11
|
+
packages_action(:update, @packages, :assumeyes => assumeyes_val)
|
10
12
|
end
|
11
13
|
|
12
14
|
def necessary?
|
@@ -76,13 +76,6 @@ module ForemanMaintain
|
|
76
76
|
execute('hostname -f')
|
77
77
|
end
|
78
78
|
|
79
|
-
def install_packages(packages, options = {})
|
80
|
-
options.validate_options!(:assumeyes)
|
81
|
-
yum_options = []
|
82
|
-
yum_options << '-y' if options[:assumeyes]
|
83
|
-
execute!("yum #{yum_options.join(' ')} install #{packages.join(' ')}", :interactive => true)
|
84
|
-
end
|
85
|
-
|
86
79
|
def server?
|
87
80
|
find_package('foreman')
|
88
81
|
end
|
@@ -103,6 +96,15 @@ module ForemanMaintain
|
|
103
96
|
:interactive => true)
|
104
97
|
end
|
105
98
|
|
99
|
+
def clean_all_packages(options = {})
|
100
|
+
options.validate_options!(:assumeyes)
|
101
|
+
yum_options = []
|
102
|
+
yum_options << '-y' if options[:assumeyes]
|
103
|
+
execute!("yum #{yum_options.join(' ')} clean all", :interactive => true)
|
104
|
+
execute!('rm -rf /var/cache/yum')
|
105
|
+
execute!('rm -rf /var/cache/dnf')
|
106
|
+
end
|
107
|
+
|
106
108
|
def package_version(name)
|
107
109
|
# space for extension to support non-rpm distributions
|
108
110
|
rpm_version(name)
|
@@ -52,8 +52,8 @@ module ForemanMaintain
|
|
52
52
|
begin
|
53
53
|
FileUtils.mkdir_p(dir_path, :mode => 0o750) unless File.exist?(dir_path)
|
54
54
|
rescue StandardError => e
|
55
|
-
|
56
|
-
|
55
|
+
warn "No permissions to create dir #{dir_path_str}"
|
56
|
+
warn e.message.inspect
|
57
57
|
end
|
58
58
|
dir_path
|
59
59
|
end
|
@@ -24,6 +24,7 @@ module ForemanMaintain
|
|
24
24
|
@all_features_scanned = false
|
25
25
|
@available_checks = nil
|
26
26
|
@available_scenarios = nil
|
27
|
+
@scenarios ||= Scenario.all_sub_classes.select(&:autodetect?)
|
27
28
|
end
|
28
29
|
|
29
30
|
def available_features(filter_conditions = nil)
|
@@ -57,8 +58,7 @@ module ForemanMaintain
|
|
57
58
|
def available_scenarios(filter_conditions = nil)
|
58
59
|
unless @available_scenarios
|
59
60
|
ensure_features_detected
|
60
|
-
@available_scenarios =
|
61
|
-
select(&:present?).map(&:new)
|
61
|
+
@available_scenarios = @scenarios.select(&:present?).map(&:new)
|
62
62
|
end
|
63
63
|
filter(@available_scenarios, filter_conditions)
|
64
64
|
end
|
@@ -73,6 +73,10 @@ module ForemanMaintain
|
|
73
73
|
@all_features_scanned = true
|
74
74
|
end
|
75
75
|
|
76
|
+
def all_scenarios(filter_conditions = nil)
|
77
|
+
filter(@scenarios.map(&:new), filter_conditions)
|
78
|
+
end
|
79
|
+
|
76
80
|
private
|
77
81
|
|
78
82
|
def sort(collection)
|
@@ -158,7 +158,7 @@ module ForemanMaintain
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def self.new_from_hash(hash)
|
161
|
-
scenarios =
|
161
|
+
scenarios = find_all_scenarios(:label => hash[:label])
|
162
162
|
unless scenarios.size == 1
|
163
163
|
raise "Could not find scenario #{hash[:label]}, found #{scenarios.size} scenarios"
|
164
164
|
end
|
@@ -67,7 +67,7 @@ module ForemanMaintain
|
|
67
67
|
def scenario(phase)
|
68
68
|
return @scenario_cache[phase] if @scenario_cache.key?(phase)
|
69
69
|
condition = { :tags => [tag, phase] }
|
70
|
-
matching_scenarios =
|
70
|
+
matching_scenarios = find_all_scenarios(condition)
|
71
71
|
raise "Too many scenarios match #{condition.inspect}" if matching_scenarios.size > 1
|
72
72
|
@scenario_cache[phase] = matching_scenarios.first
|
73
73
|
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: 0.0.
|
4
|
+
version: 0.0.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: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -53,21 +53,21 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: mocha
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,19 +81,19 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "<"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 11.0.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "<"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 11.0.0
|
97
97
|
description: Provides various features that helps keeping the Foreman/Satellite up
|
98
98
|
and running.
|
99
99
|
email: inecas@redhat.com
|