Module: ForemanMaintain::Concerns::Downstream
- Defined in:
- lib/foreman_maintain/concerns/downstream.rb
Constant Summary collapse
- SATELLITE_MAINTAIN_CONFIG =
'/usr/share/satellite-maintain/config.yml'.freeze
Instance Method Summary collapse
- #absent_repos(version) ⇒ Object
- #current_version ⇒ Object
- #fm_pkg_and_cmd_name ⇒ Object
- #package_name ⇒ Object
- #repository_manager ⇒ Object
- #rhsm_refresh ⇒ Object
- #satellite_maintain_target_version ⇒ Object
- #satellite_upgrade_allowed? ⇒ Boolean
-
#setup_repositories(version) ⇒ Object
TODO: Modify activation_key changes as per server.
-
#subscribed_using_activation_key? ⇒ Boolean
TODO: Verify this is valid for capsule?.
Instance Method Details
#absent_repos(version) ⇒ Object
28 29 30 31 32 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 28 def absent_repos(version) repos_required = rh_repos(version) repos_found = repos_required & repository_manager.rhsm_list_repos.keys repos_required - repos_found end |
#current_version ⇒ Object
6 7 8 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 6 def current_version raise NotImplementedError end |
#fm_pkg_and_cmd_name ⇒ Object
47 48 49 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 47 def fm_pkg_and_cmd_name %w[satellite-maintain satellite-maintain] end |
#package_name ⇒ Object
43 44 45 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 43 def package_name raise NotImplementedError end |
#repository_manager ⇒ Object
10 11 12 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 10 def repository_manager ForemanMaintain.repository_manager end |
#rhsm_refresh ⇒ Object
34 35 36 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 34 def rhsm_refresh execute!(%(subscription-manager refresh)) end |
#satellite_maintain_target_version ⇒ Object
51 52 53 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 51 def satellite_maintain_target_version satellite_maintain_config['current_satellite_version'] end |
#satellite_upgrade_allowed? ⇒ Boolean
55 56 57 58 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 55 def satellite_upgrade_allowed? current_minor_version == satellite_maintain_config['previous_satellite_version'] || ForemanMaintain.upgrade_in_progress == satellite_maintain_target_version end |
#setup_repositories(version) ⇒ Object
TODO: Modify activation_key changes as per server
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 15 def setup_repositories(version) activation_key = ENV['EXTERNAL_SAT_ACTIVATION_KEY'] org = ENV['EXTERNAL_SAT_ORG'] if activation_key = org ? %(--org #{shellescape(org)}) : '' execute!(%(subscription-manager register #{}\ --activationkey #{shellescape(activation_key)} --force)) else repository_manager.rhsm_disable_repos(['*']) repository_manager.rhsm_enable_repos(rh_repos(version)) end end |
#subscribed_using_activation_key? ⇒ Boolean
TODO: Verify this is valid for capsule?
39 40 41 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 39 def subscribed_using_activation_key? ENV['EXTERNAL_SAT_ACTIVATION_KEY'] && ENV['EXTERNAL_SAT_ORG'] end |