Module: ForemanRemoteExecution::HostExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/foreman_remote_execution/host_extensions.rb
Instance Method Summary collapse
- #becomes_with_remote_execution(*args) ⇒ Object
- #drop_execution_interface_cache ⇒ Object
- #execution_interface ⇒ Object
- #execution_status(options = {}) ⇒ Object
- #execution_status_label(options = {}) ⇒ Object
- #host_params_with_remote_execution ⇒ Object
- #reload_with_remote_execution(*args) ⇒ Object
-
#remote_execution_proxies(provider, authorized = true) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity.
- #remote_execution_ssh_keys ⇒ Object
Instance Method Details
#becomes_with_remote_execution(*args) ⇒ Object
96 97 98 99 100 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 96 def becomes_with_remote_execution(*args) became = becomes_without_remote_execution(*args) became.drop_execution_interface_cache if became.respond_to? :drop_execution_interface_cache became end |
#drop_execution_interface_cache ⇒ Object
92 93 94 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 92 def drop_execution_interface_cache @execution_interface = nil end |
#execution_interface ⇒ Object
64 65 66 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 64 def execution_interface get_interface_by_flag(:execution) end |
#execution_status(options = {}) ⇒ Object
45 46 47 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 45 def execution_status( = {}) @execution_status ||= get_status(HostStatus::ExecutionStatus).to_status() end |
#execution_status_label(options = {}) ⇒ Object
49 50 51 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 49 def execution_status_label( = {}) @execution_status_label ||= get_status(HostStatus::ExecutionStatus).to_label() end |
#host_params_with_remote_execution ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 53 def host_params_with_remote_execution params = host_params_without_remote_execution keys = remote_execution_ssh_keys params['remote_execution_ssh_keys'] = keys if keys.present? [:remote_execution_ssh_user, :remote_execution_effective_user_method, :remote_execution_connect_by_ip].each do |key| params[key.to_s] = Setting[key] unless params.key?(key.to_s) end params end |
#reload_with_remote_execution(*args) ⇒ Object
102 103 104 105 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 102 def reload_with_remote_execution(*args) drop_execution_interface_cache reload_without_remote_execution(*args) end |
#remote_execution_proxies(provider, authorized = true) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 69 def remote_execution_proxies(provider, = true) proxies = {} proxies[:subnet] = execution_interface.subnet.remote_execution_proxies.with_features(provider) if execution_interface && execution_interface.subnet proxies[:fallback] = smart_proxies.with_features(provider) if Setting[:remote_execution_fallback_proxy] if Setting[:remote_execution_global_proxy] proxy_scope = if Taxonomy.enabled_taxonomies.any? && User.current.present? ::SmartProxy.with_taxonomy_scope_override(location, organization) else ::SmartProxy.unscoped end proxy_scope = proxy_scope. if proxies[:global] = proxy_scope.with_features(provider) end proxies end |
#remote_execution_ssh_keys ⇒ Object
88 89 90 |
# File 'app/models/concerns/foreman_remote_execution/host_extensions.rb', line 88 def remote_execution_ssh_keys remote_execution_proxies('SSH', false).values.flatten.uniq.map { |proxy| proxy.pubkey }.compact.uniq end |