Module: PuppetX::EnterpriseModules::Oracle::DefaultSid
- Defined in:
- lib/puppet_x/enterprisemodules/oracle/default_sid.rb
Overview
This modules includes all processing needed to allow consistent behaviour for default resources. Specially on a first run.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(parent) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/puppet_x/enterprisemodules/oracle/default_sid.rb', line 12 def self.included(parent) current_version = Gem::Version.new(Puppet.version) requested_version = Gem::Version.new('3.6.3') if current_version <= requested_version parent.send(:define_method, :generate) do fill_in_default_sid [] end else parent.send(:define_method, :pre_run_check) do fill_in_default_sid end end end |
Instance Method Details
#fill_in_default_sid ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/puppet_x/enterprisemodules/oracle/default_sid.rb', line 27 def fill_in_default_sid return if sid # # First we check if any ora_setting type is in the catalog. If it is, we use that. # default_setting = catalog.resources.select { |r| r.type == :ora_setting && r.default.to_s == 'true' } # # If the search for ora_setting in the catalog didn't find anything, we need to search # on. The default can also be a single node ora_database entry in the catalog. Because # ora_database also add's content to the ora_settings.yaml file, But DOESN'T # create a catalog entry for that. # default_setting = catalog.resources.select { |r| r.type == :ora_database } if default_setting.empty? fail 'You need to specify the sid or specify a ora_setting as default in your manifest' if default_setting.empty? sid = default_setting.first[:name] self[:name] = if self[:name][-1..-1] == '@' self[:name] + sid else "#{self[:name]}@#{sid}" end self[:sid] = sid end |