Sha256: 158349b8b43ab28d90af9282a15b0dcadf0741d960e680c5d84e6d4d801c74a5

Contents?: true

Size: 864 Bytes

Versions: 9

Compression:

Stored size: 864 Bytes

Contents

module ForemanAnsible
  # Contains proxy selection rules for a host playbook run
  class ProxySelector < ::ForemanTasks::ProxySelector
    def available_proxies(host)
      proxies = {}
      proxies[:fallback] = host.smart_proxies.with_features('Ansible')
      proxies[:global] = proxy_scope(host).authorized.with_features('Ansible')
      proxies
    end

    def determine_proxy(*args)
      result = super
      return result unless result == :not_available
      # Always run roles in some way, even if there are no proxies, Foreman
      # should take that role in that case.
      :not_defined
    end

    private

    def proxy_scope(host)
      return ::SmartProxy unless Taxonomy.enabled_taxonomies.any?
      ::SmartProxy.with_taxonomy_scope_override(host.location,
                                                host.organization)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_ansible-1.5.2 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.5.1 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.5.0 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.6 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.5 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.3 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.2 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.1 app/services/foreman_ansible/proxy_selector.rb
foreman_ansible-1.4.0 app/services/foreman_ansible/proxy_selector.rb