Class: Puppet_X::Coi::Jboss::Provider::SecurityDomain::AbstractProvider
- Inherits:
-
Object
- Object
- Puppet_X::Coi::Jboss::Provider::SecurityDomain::AbstractProvider
- Defined in:
- lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.rb
Overview
A module for JBoss security domain common abstract resource
Direct Known Subclasses
Constant Summary collapse
- COMMAND_SPLITTER =
','
- NEWLINE_REPLACEMENT =
' '
Instance Method Summary collapse
-
#build_main_command ⇒ String
Creates a parametrized command to be executed by resource.
-
#compile_command(base_command, resource) ⇒ String
Methods that compiles jboss command.
-
#get_commands(state, resource) ⇒ List
Method that decides about what commands should be executed.
-
#initialize(resource, compilator) ⇒ AbstractProvider
constructor
Standard constructor.
Constructor Details
#initialize(resource, compilator) ⇒ AbstractProvider
Standard constructor
7 8 9 10 |
# File 'lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.rb', line 7 def initialize(resource, compilator) @resource = resource @compilator = compilator end |
Instance Method Details
#build_main_command ⇒ String
Creates a parametrized command to be executed by resource
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.rb', line 17 def build_main_command res = @resource correct_cmd = correct_command_template_begining(res) = [] res[:moduleoptions].keys.sort.each do |key| value = res[:moduleoptions][key] val = value # FIXME: After coi-gov-pl/puppet-jboss#59 is resolved the fallowing lines # should be moved to mungle function in securitydomain type not resource val = 'undefined' if val.nil? val = val.to_s if val.is_a?(Symbol) # New lines in values are not supported, they can't be passed to JBoss CLI val = val.gsub(/\n/, NEWLINE_REPLACEMENT).strip if val.is_a?(String) << module_option_template % [key.inspect, val.inspect] end correct_cmd += .join(COMMAND_SPLITTER) + correct_command_template_ending end |
#compile_command(base_command, resource) ⇒ String
Methods that compiles jboss command
45 46 47 |
# File 'lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.rb', line 45 def compile_command(base_command, resource) @compilator.compile(resource[:runasdomain], resource[:profile], base_command) end |
#get_commands(state, resource) ⇒ List
Method that decides about what commands should be executed
38 39 40 |
# File 'lib/puppet_x/coi/jboss/provider/securitydomain/abstract_provider.rb', line 38 def get_commands(state, resource) decide(resource, state) end |