Class: ForemanOpenscap::ClientConfig::Ansible

Inherits:
Base
  • Object
show all
Defined in:
app/services/foreman_openscap/client_config/ansible.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#all_collection_method, #collection_method, #ds_policies_param_default_value, #find_config_item, #managed_overrides?

Constructor Details

#initialize(policy_class) ⇒ Ansible

Returns a new instance of Ansible.



9
10
11
12
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 9

def initialize(policy_class)
  raise "Unknown policy class, expected one of: #{policy_types.map(&to_s).join(', ')}" unless policy_types.include?(policy_class)
  initialize_constants(policy_class)
end

Instance Attribute Details

#constantsObject (readonly)

Returns the value of attribute constants.



5
6
7
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 5

def constants
  @constants
end

Instance Method Details

#ansible_role_missing_msgObject



33
34
35
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 33

def ansible_role_missing_msg
  _("theforeman.foreman_scap_client Ansible Role not found, please import it before running this action again.")
end

#available?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 18

def available?
  Foreman::Plugin.installed?("foreman_ansible")
end

#inline_helpObject



22
23
24
25
26
27
28
29
30
31
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 22

def inline_help
  t1 = _("Requires Ansible plugin, %s Ansible role and variables. This will assign the role to the hosts or selected hostgroups.") % ansible_role_name
  t2 = _("To deploy foreman_scap_client, ansible roles run needs to be triggered manually. Manual run is also required after any change to this policy.")

  {
    :text => "#{t1}<br>#{t2}",
    :replace_text => 'Ansible role',
    :route_helper_method => :hash_for_ansible_roles_path
  }
end

#typeObject



14
15
16
# File 'app/services/foreman_openscap/client_config/ansible.rb', line 14

def type
  :ansible
end