diff options
author | 2016-05-16 07:40:31 -0700 | |
---|---|---|
committer | 2016-05-16 07:40:31 -0700 | |
commit | 8dcfe1a692815ee3a34dca32fd427471dfd0046a (patch) | |
tree | 5619e2c7b7113fe6ec68c98064895f7d8723e5bb /components/congress/install/puppet/lib | |
parent | e50f20b9c29fd6282025b4ccb87fedacb013ef66 (diff) |
Refactor installer code folders.
JIRA: COPPER-2
Add initial centos7 bash scripts in development.
Change-Id: I112aa43c231dac035f0d1bc2ae416fabf6b8b650
Signed-off-by: blsaws <bs3131@att.com>
Diffstat (limited to 'components/congress/install/puppet/lib')
-rw-r--r-- | components/congress/install/puppet/lib/puppet/provider/congress_config/ini_setting.rb | 27 | ||||
-rw-r--r-- | components/congress/install/puppet/lib/puppet/type/congress_config.rb | 42 |
2 files changed, 69 insertions, 0 deletions
diff --git a/components/congress/install/puppet/lib/puppet/provider/congress_config/ini_setting.rb b/components/congress/install/puppet/lib/puppet/provider/congress_config/ini_setting.rb new file mode 100644 index 0000000..3d324b6 --- /dev/null +++ b/components/congress/install/puppet/lib/puppet/provider/congress_config/ini_setting.rb @@ -0,0 +1,27 @@ +Puppet::Type.type(:congress_config).provide( + :ini_setting, + :parent => Puppet::Type.type(:ini_setting).provider(:ruby) +) do + + def section + resource[:name].split('/', 2).first + end + + def setting + resource[:name].split('/', 2).last + end + + def separator + '=' + end + + def self.file_path + '/etc/congress/congress.conf' + end + + # added for backwards compatibility with older versions of inifile + def file_path + self.class.file_path + end + +end diff --git a/components/congress/install/puppet/lib/puppet/type/congress_config.rb b/components/congress/install/puppet/lib/puppet/type/congress_config.rb new file mode 100644 index 0000000..3b76fc6 --- /dev/null +++ b/components/congress/install/puppet/lib/puppet/type/congress_config.rb @@ -0,0 +1,42 @@ +Puppet::Type.newtype(:congress_config) do + + ensurable + + newparam(:name, :namevar => true) do + desc 'Section/setting name to manage from /etc/congress/congress.conf' + newvalues(/\S+\/\S+/) + end + + newproperty(:value) do + desc 'The value of the setting to be defined.' + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value + end + + def is_to_s( currentvalue ) + if resource.secret? + return '[old secret redacted]' + else + return currentvalue + end + end + + def should_to_s( newvalue ) + if resource.secret? + return '[new secret redacted]' + else + return newvalue + end + end + end + + newparam(:secret, :boolean => true) do + desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' + + newvalues(:true, :false) + + defaultto false + end +end |