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
- REDHAT_REPO_FILE =
'/etc/yum.repos.d/redhat.repo'.freeze
Instance Method Summary collapse
- #absent_repos(version) ⇒ Object
- #connected? ⇒ Boolean
- #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
29 30 31 32 33 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 29 def absent_repos(version) repos_required = rh_repos(version) repos_found = repos_required & repository_manager.rhsm_list_repos.keys repos_required - repos_found end |
#connected? ⇒ Boolean
61 62 63 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 61 def connected? File.exist?(REDHAT_REPO_FILE) && File.new(REDHAT_REPO_FILE).read.include?('https://cdn.redhat.com') end |
#current_version ⇒ Object
7 8 9 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 7 def current_version raise NotImplementedError end |
#fm_pkg_and_cmd_name ⇒ Object
48 49 50 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 48 def fm_pkg_and_cmd_name %w[satellite-maintain satellite-maintain] end |
#package_name ⇒ Object
44 45 46 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 44 def package_name raise NotImplementedError end |
#repository_manager ⇒ Object
11 12 13 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 11 def repository_manager ForemanMaintain.repository_manager end |
#rhsm_refresh ⇒ Object
35 36 37 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 35 def rhsm_refresh execute!(%(subscription-manager refresh)) end |
#satellite_maintain_target_version ⇒ Object
52 53 54 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 52 def satellite_maintain_target_version satellite_maintain_config['current_satellite_version'] end |
#satellite_upgrade_allowed? ⇒ Boolean
56 57 58 59 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 56 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
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 16 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 #{org_options}\ --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?
40 41 42 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 40 def subscribed_using_activation_key? ENV['EXTERNAL_SAT_ACTIVATION_KEY'] && ENV['EXTERNAL_SAT_ORG'] end |