Class: Puppet_X::EnterpriseModules::WebLogic::Daemon
- Inherits:
-
Object
- Object
- Puppet_X::EnterpriseModules::WebLogic::Daemon
- Includes:
- EasyType::Encryption, EasyType::Template
- Defined in:
- lib/puppet_x/enterprisemodules/weblogic/daemon.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
2 minutes
ENV.fetch('WLS_CONFIG_DAEMON_READ_TIMEOUT', nil) || 120
Instance Method Summary collapse
- #execute_script(script, timeout = DEFAULT_TIMEOUT) ⇒ Object
-
#initialize(user, domain, weblogic_home_dir, weblogic_user, weblogic_password, weblogic_connect_url, post_classpath, custom_trust, trust_keystore_file, trust_keystore_passphrase, wlst_args) ⇒ Daemon
constructor
A new instance of Daemon.
Constructor Details
#initialize(user, domain, weblogic_home_dir, weblogic_user, weblogic_password, weblogic_connect_url, post_classpath, custom_trust, trust_keystore_file, trust_keystore_passphrase, wlst_args) ⇒ Daemon
Returns a new instance of Daemon.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/puppet_x/enterprisemodules/weblogic/daemon.rb', line 16 def initialize(user, domain, weblogic_home_dir, weblogic_user, weblogic_password, weblogic_connect_url, post_classpath, custom_trust, trust_keystore_file, trust_keystore_passphrase, wlst_args) @user = user @domain = domain @weblogic_home_dir = weblogic_home_dir @weblogic_user = weblogic_user @weblogic_password = weblogic_password.nil? ? '' : decrypted_value(weblogic_password) @weblogic_connect_url = weblogic_connect_url @post_classpath = post_classpath @custom_trust = custom_trust @trust_keystore_file = trust_keystore_file @trust_keystore_passphrase = trust_keystore_passphrase.nil? ? '' : decrypted_value(trust_keystore_passphrase) @wlst_args = wlst_args @daemon = EasyType::Daemon.run(identity) return if @daemon if @custom_trust.to_s == 'true' # rubocop:disable Layout/LineLength @trust_parameters = "-Dweblogic.security.TrustKeyStore=CustomTrust -Dweblogic.security.CustomTrustKeyStoreFileName=#{@trust_keystore_file} -Dweblogic.security.CustomTrustKeystorePassPhrase=#{@trust_keystore_passphrase}" # rubocop:enable Layout/LineLength Puppet.debug "trust parameters #{@trust_parameters}" else Puppet.debug 'no custom trust' end start_daemon end |
Instance Method Details
#execute_script(script, timeout = DEFAULT_TIMEOUT) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/puppet_x/enterprisemodules/weblogic/daemon.rb', line 44 def execute_script(script, timeout = DEFAULT_TIMEOUT) Puppet.debug "Executing wls-script #{script} with timeout = #{timeout}" time = Benchmark.realtime do reconnect_to_wls daemon.execute_command "execfile('#{script}')" daemon.sync(timeout) rescue EOFError, ThreadError @retries = @retries.nil? ? 1 : @retries + 1 fail 'maximum number of retries for daemon restart exhausted.' if @retries == 3 Puppet.debug 'Detected stopped daemon. restarting it...' @daemon.kill start_daemon retry end Puppet.debug "Time elapsed #{time * 1000} milliseconds on script #{script}" end |