lib/puppet_x/coi/jboss/internal/cli_executor.rb
# Method that prepares command to be executed
#
# @param path [String]  path for execution
# @param ctrlcfg [Hash] hash with configuration that is need to execute command
# @return [PuppetX::Coi::Jboss::Value::Command] a command with environment
Method that prepares command to be executed
Method that prepares command to be executed
def prepare_command(path, ctrlcfg)
    home = check_not_empty PuppetX::Coi::Jboss::Configuration.config_value(:home)
    jboss_cli = "#{home}/bin/jboss-cli.sh"
    environment = ENV.to_hash
    environment['JBOSS_HOME'] = home
    cmd = "#{jboss_cli} #{timeout_cli} --connect --file=#{path} --controller=#{ctrlcfg[:controller]}"
    cmd += " --user=#{ctrlcfg[:ctrluser]}" unless ctrlcfg[:ctrluser].nil?
    unless ctrlcfg[:ctrlpasswd].nil?
      environment['__PASSWD'] = ctrlcfg[:ctrlpasswd]
      cmd += ' --password=$__PASSWD'
    end
    PuppetX::Coi::Jboss::Value::Command.new cmd, environment
  end
def prepare_command ( path , ctrlcfg ) home = check_not_empty PuppetX :: Coi :: Jboss :: Configuration . config_value ( :home ) jboss_cli = "#{home}/bin/jboss-cli.sh" environment = ENV . to_hash environment [ 'JBOSS_HOME' ] = home cmd = "#{jboss_cli} #{timeout_cli} --connect --file=#{path} --controller=#{ctrlcfg[:controller]}" cmd += " --user=#{ctrlcfg[:ctrluser]}" unless ctrlcfg [ :ctrluser ] . nil? unless ctrlcfg [ :ctrlpasswd ] . nil? environment [ '__PASSWD' ] = ctrlcfg [ :ctrlpasswd ] cmd += ' --password=$__PASSWD' end PuppetX :: Coi :: Jboss :: Value :: Command . new cmd , environment end
Method that prepares command to be executed
Method that prepares command to be executed
a command with environment
a command with environment
PuppetX::Coi::Jboss::Value::Command
path
path for execution
path for execution
ctrlcfg
hash with configuration that is need to execute command
hash with configuration that is need to execute command