Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hiera overrides not being applied #544

Open
LBanzato opened this issue Nov 15, 2018 · 1 comment
Open

hiera overrides not being applied #544

LBanzato opened this issue Nov 15, 2018 · 1 comment

Comments

@LBanzato
Copy link

LBanzato commented Nov 15, 2018

We have a scenario where we use the orawls (release 2.0.19) module and where puppet is run as a non-root user.
Due to the limited permissions of the user running puppet it doesn't have access to /etc, so we defined the override_wls_setting_file to create the wls_settings.yaml file somewhere else:

wls_domains_file:           &wls_domains_file           '/opt/oracle/wls_domains.yaml'
wls_setting_file:           &wls_setting_file           '/opt/oracle/wls_setting.yaml'
override_wls_domains_file:                              "%{lookup('wls_domains_file')}"
override_wls_setting_file:                              "%{lookup('wls_setting_file')}"

However, it seems the module is not picking that up and using its default (thus failing due to the lack for permissions):

Error: /Stage[main]/Domains/Wls_setting[ut01osb_domain]: Could not evaluate: Permission denied @ rb_sysopen - /etc/wls_setting.yaml
/vagrant/puppet/modules/modules-standard/orawls/lib/puppet/provider/wls_setting/yaml.rb:32:in `initialize'
/vagrant/puppet/modules/modules-standard/orawls/lib/puppet/provider/wls_setting/yaml.rb:32:in `open'
/vagrant/puppet/modules/modules-standard/orawls/lib/puppet/provider/wls_setting/yaml.rb:32:in `write_yaml'
/vagrant/puppet/modules/modules-standard/orawls/lib/puppet/provider/wls_setting/yaml.rb:14:in `flush'

If I do a hiera lookup, it does find my custom location (/opt/oracle instead of /etc):

$ puppet lookup override_wls_setting_file
--- "/opt/oracle/wls_setting.yaml"

As a work around I changed both ruby scripts to use the location we want as a default:
orawls/lib/puppet/type/wls_setting.rb
orawls/lib/utils/settings.rb

But I am curious to know if you came across any similar issues.

Thanks,
Luigi

@ds2000
Copy link

ds2000 commented Jun 27, 2019

Hi Luigi,
You need to set the overrides as either an environment variable :

FACTER_override_wls_domains_file=/opt/oracle/wls_domains.yaml FACTER_override_wls_setting_file=/opt/oracle/wls_setting.yaml

or in your manifest which calls Edwins module:

if ebsEnabled == "true" then
  Facter.add(:override_wls_domains_file) do
    setcode do
      override_wls_domains_file="/opt/weblogic/user_projects/wls_domains.yaml"
    end
  end
  
  Facter.add(:override_wls_setting_file) do
    setcode do
      override_wls_setting_file="/opt/weblogic/user_projects/wls_settings.yaml"
    end
  end
end

However, there is a bug in the module. The domains file override doesn't work. In the copydomain.pp and domain.pp the value is hardcoded:

String $wls_domains_file = /etc/wls_domains.yaml',

I'm going to write a separate bug to Edwin to confirm this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants