Class: PuppetX::EnterpriseModules::OraInstall::Command
- Inherits:
-
Object
- Object
- PuppetX::EnterpriseModules::OraInstall::Command
- Defined in:
- lib/puppet_x/enterprisemodules/ora_install/command.rb
Overview
docs
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_TIMEOUT =
include Settings
300
- VALID_OPTIONS =
5 minutes
[ :os_user, :oracle_home ].freeze
Instance Method Summary collapse
- #command_string(arguments = '', command_options) ⇒ Object
- #execute(arguments) ⇒ Object
-
#initialize(command, options, valid_options = VALID_OPTIONS) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(command, options, valid_options = VALID_OPTIONS) ⇒ Command
Returns a new instance of Command.
21 22 23 24 25 |
# File 'lib/puppet_x/enterprisemodules/ora_install/command.rb', line 21 def initialize(command, , = VALID_OPTIONS) @valid_options = () @command = command end |
Instance Method Details
#command_string(arguments = '', command_options) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/puppet_x/enterprisemodules/ora_install/command.rb', line 27 def command_string(arguments = '', ) if [:oracle_home] && [:os_user] oracle_home = [:oracle_home] @os_user = [:os_user] else fail "oracle_home not specfied" end "su - #{@os_user} -c \"cd #{working_dir}; export ORACLE_HOME=#{oracle_home}; export PATH=$PATH:#{oracle_home}/bin:#{oracle_home}/OPatch; #{@command} #{arguments}\"" end |
#execute(arguments) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/puppet_x/enterprisemodules/ora_install/command.rb', line 37 def execute(arguments) = { :failonfail => true, :combine => true } value = '' Puppet.debug "Executing #{@command} command: #{arguments} on #{@sid} as #{os_user}, connected as #{username}" value = Puppet::Util::Execution.execute(command_string(arguments), ) value end |