Module: ForemanMaintain::Concerns::Downstream
- Defined in:
- lib/foreman_maintain/concerns/downstream.rb
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
-
#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
26 27 28 29 30 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 26 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
4 5 6 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 4 def current_version raise NotImplementedError end |
#fm_pkg_and_cmd_name ⇒ Object
45 46 47 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 45 def fm_pkg_and_cmd_name %w[satellite-maintain satellite-maintain] end |
#package_name ⇒ Object
41 42 43 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 41 def package_name raise NotImplementedError end |
#repository_manager ⇒ Object
8 9 10 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 8 def repository_manager ForemanMaintain.repository_manager end |
#rhsm_refresh ⇒ Object
32 33 34 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 32 def rhsm_refresh execute!(%(subscription-manager refresh)) end |
#setup_repositories(version) ⇒ Object
TODO: Modify activation_key changes as per server
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 13 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?
37 38 39 |
# File 'lib/foreman_maintain/concerns/downstream.rb', line 37 def subscribed_using_activation_key? ENV['EXTERNAL_SAT_ACTIVATION_KEY'] && ENV['EXTERNAL_SAT_ORG'] end |