Sha256: f7907a5204148cbecbfcfb9029d28f458a9684c936b3486e5339b57818493b69

Contents?: true

Size: 735 Bytes

Versions: 42

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module ForemanAnsible
  # Chained methods to extend the hosts menu with Ansible actions
  module HostsHelperExtensions
    extend ActiveSupport::Concern

    module Overrides
      def multiple_actions
        actions = super
        if User.current.can?(:create_job_invocations) &&
           User.current.can?(:play_roles_on_host)
          actions += [[_('Run all Ansible roles'),
                       multiple_play_roles_hosts_path,
                       false]]
        end
        actions
      end
    end

    included do
      prepend Overrides
    end

    def ansible_roles_present?(host)
      host.ansible_roles.present? ||
        host.inherited_ansible_roles.present?
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
foreman_ansible-7.1.8 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.7 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.6 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.5 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.4 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.3 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.2 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.1 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.0.4 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.1.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.0.3 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.0.2 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.0.1 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-7.0.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.3.4 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.3.3 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.3.2 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.3.1 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.4.1 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-6.4.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb