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, :cwd ].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 36 37 38 |
# File 'lib/puppet_x/enterprisemodules/ora_install/command.rb', line 27 def command_string(arguments = '', ) fail 'oracle_home not specfied' unless [:oracle_home] fail 'os_user not specified' unless [:os_user] oracle_home = [:oracle_home] @os_user = [:os_user] if Facter.value(:kernel) == 'windows' "#{oracle_home}\\OPatch\\#{@command}.bat #{arguments}" else "su - #{@os_user} -c \"cd #{working_dir()}; export ORACLE_HOME=#{oracle_home}; export PATH=$PATH:#{oracle_home}/bin:#{oracle_home}/OPatch; #{@command} #{arguments}\"" end end |
#execute(arguments) ⇒ Object
40 41 42 43 44 |
# File 'lib/puppet_x/enterprisemodules/ora_install/command.rb', line 40 def execute(arguments) = { :failonfail => true, :combine => true } Puppet.debug "Executing #{@command} command: #{arguments} on #{@sid} as #{os_user}, connected as #{username}" Puppet::Util::Execution.execute(command_string(arguments), ) end |