Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Puppet changes for cloud admin access to contrail-analytics-api
Closes-Bug: #1461175 (cherry picked from commit 40982d6) 2. Rename cloud_admin_access_only to multi_tenancy and default to False for now Closes-Bug: #1461175 (cherry picked from commit 21f4096) 3. Rename multi_tenancy to aaa_mode for analytics API Partial-Bug: #1599654 (cherry picked from commit 3afb90a) Change-Id: Ib58572052d8159398da973076c139e8aecc02268
- Loading branch information
Megh Bhatt
committed
Jul 28, 2016
1 parent
df34544
commit de213a3
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ent/modules/contrail/lib/puppet/provider/contrail_analytics_api_ini_config/ini_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Puppet::Type.type(:contrail_analytics_api_ini_config).provide( | ||
:ini_setting, | ||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby) | ||
) do | ||
|
||
# the setting is always default | ||
# this if for backwards compat with the old puppet providers | ||
# for snmp_collector_config | ||
def section | ||
resource[:name].split('/', 2).first | ||
end | ||
|
||
# assumes that the name was the setting | ||
# this is to maintain backwards compat with the the older | ||
# stuff | ||
def setting | ||
resource[:name].split('/', 2).last | ||
end | ||
|
||
def separator | ||
'=' | ||
end | ||
|
||
def self.file_path | ||
'/etc/contrail/supervisord_analytics_files/contrail-analytics-api.ini' | ||
end | ||
|
||
# added for backwards compatibility with older versions | ||
# of inifile | ||
def file_path | ||
self.class.file_path | ||
end | ||
|
||
end |
42 changes: 42 additions & 0 deletions
42
contrail/environment/modules/contrail/lib/puppet/type/contrail_analytics_api_ini_config.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Puppet::Type.newtype(:contrail_analytics_api_ini_config) do | ||
|
||
ensurable | ||
|
||
newparam(:name, :namevar => true) do | ||
desc 'Section/setting name to manage from /etc/contrail/supervisord_analytics_files/contrail-analytics-api.ini' | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters