-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathupdate.rb
More file actions
139 lines (127 loc) · 4.43 KB
/
update.rb
File metadata and controls
139 lines (127 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
module Scenarios::Update
class Abstract < ForemanMaintain::Scenario
def self.update_metadata(&block)
metadata do
tags :update_scenario
confine do
feature(:instance).target_version == feature(:instance).current_major_version
end
instance_eval(&block)
end
end
end
class PreUpdateCheck < Abstract
update_metadata do
description 'Checks before updating'
tags :pre_update_checks
run_strategy :fail_slow
end
# rubocop:disable Metrics/MethodLength
def compose
add_steps(
Checks::Foreman::FactsNames, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
Checks::ServerPing,
Checks::ServicesUp,
Checks::SystemRegistration,
Checks::CheckHotfixInstalled,
Checks::CheckTmout,
Checks::CheckSubscriptionManagerRelease,
Checks::CheckIpv6Disable,
Checks::CheckUpstreamRepository,
Checks::Container::PodmanLogin, # if downstream, connected, containers used
Checks::Disk::AvailableSpace,
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
Checks::Foreman::ValidateExternalDbVersion, # if external database
Checks::Foreman::CheckCorruptedRoles,
Checks::Foreman::CheckDuplicatePermissions,
Checks::Foreman::TuningRequirements, # if katello present
Checks::ForemanOpenscap::InvalidReportAssociations, # if foreman-openscap
Checks::ForemanTasks::Invalid::CheckOld, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPendingState, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPlanningState, # if foreman-tasks
Checks::ForemanTasks::NotRunning, # if foreman-tasks
Checks::Pulpcore::NoRunningTasks, # if pulpcore
Checks::NonRhPackages,
Checks::PackageManager::Dnf::ValidateDnfConfig,
Checks::Repositories::CheckNonRhRepository,
Checks::Repositories::Validate
)
end
# rubocop:enable Metrics/MethodLength
end
class PreMigrations < Abstract
update_metadata do
description 'Procedures before migrating'
tags :pre_migrations
end
def compose
add_steps(
Procedures::Packages::Update.new(
:assumeyes => true,
:download_only => true
),
Procedures::Iop::Update.new(:version => feature(:instance).current_major_version),
Procedures::MaintenanceMode::EnableMaintenanceMode,
Procedures::Crond::Stop,
Procedures::Timer::Stop,
Procedures::SyncPlans::Disable
)
end
end
class Migrations < Abstract
update_metadata do
description 'Migration scripts'
tags :migrations
run_strategy :fail_fast
end
def compose
add_steps(
Procedures::Service::Stop,
Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false),
Procedures::Installer::Run.new(:assumeyes => true),
Procedures::Installer::UpgradeRakeTask
)
end
end
class PostMigrations < Abstract
update_metadata do
description 'Procedures after migrating'
tags :post_migrations
end
def compose
add_steps(
Procedures::RefreshFeatures,
Procedures::Service::Start,
Procedures::Crond::Start,
Procedures::Timer::Start,
Procedures::SyncPlans::Enable,
Procedures::MaintenanceMode::DisableMaintenanceMode,
Procedures::Iop::ImagePrune,
)
end
end
class PostUpdateChecks < Abstract
update_metadata do
description 'Checks after update'
tags :post_update_checks
run_strategy :fail_slow
end
def compose
add_steps(
Checks::Foreman::FactsNames, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
Checks::ServerPing,
Checks::ServicesUp,
Checks::SystemRegistration,
Procedures::Packages::CheckForReboot
)
end
end
end