Skip to content

Commit

Permalink
1. Puppet changes for cloud admin access to contrail-analytics-api
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
@@ -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
@@ -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
Expand Up @@ -32,6 +32,7 @@

$contrail_snmp_collector_ini_command ="/usr/bin/contrail-snmp-collector --conf_file /etc/contrail/contrail-snmp-collector.conf --conf_file /etc/contrail/contrail-keystone-auth.conf"
$contrail_topology_ini_command ="/usr/bin/contrail-topology --conf_file /etc/contrail/contrail-topology.conf --conf_file /etc/contrail/contrail-keystone-auth.conf"
$contrail_analytics_api_ini_command ="/usr/bin/contrail-analytics-api --conf_file /etc/contrail/contrail-analytics-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf"

$redis_config_file = '/etc/redis/redis.conf'
$redis_augeas_lens_to_use = 'spacevars.lns'
Expand Down Expand Up @@ -70,6 +71,7 @@
'DEFAULTS/analytics_config_audit_ttl' : value => $analytics_config_audit_ttl;
'DEFAULTS/analytics_statistics_ttl' : value => $analytics_statistics_ttl;
'DEFAULTS/analytics_flow_ttl' : value => $analytics_flow_ttl;
'DEFAULTS/aaa_mode' : value => 'cloud-admin-only';
'DISCOVERY/disc_server_ip' : value => $config_ip_to_use;
'DISCOVERY/disc_server_port' : value => '5998';
'REDIS/redis_server_port' : value => '6379';
Expand Down Expand Up @@ -148,6 +150,21 @@
'DISCOVERY/disc_server_port' : value => '5998';
} ->

contrail_analytics_api_ini_config {
'program:contrail-analytics-api/command' : value => $contrail_analytics_api_ini_command;
'program:contrail-analytics-api/priority' : value => '440';
'program:contrail-analytics-api/autostart' : value => 'true';
'program:contrail-analytics-api/killasgroup' : value => 'true';
'program:contrail-analytics-api/stopsignal' : value => 'KILL';
'program:contrail-analytics-api/stdout_capture_maxbytes' : value => '1MB';
'program:contrail-analytics-api/redirect_stderr' : value => 'true';
'program:contrail-analytics-api/stdout_logfile' : value => '/var/log/contrail/contrail-analytics-api-stdout.log';
'program:contrail-analytics-api/stderr_logfile' : value => '/var/log/contrail/contrail-analytics-api-stderr.log';
'program:contrail-analytics-api/startsecs' : value => '5';
'program:contrail-analytics-api/exitcodes' : value => '0';
'program:contrail-analytics-api/user' : value => 'contrail';
} ->

contrail_snmp_collector_ini_config {
'program:contrail-snmp-collector/command' : value => $contrail_snmp_collector_ini_command;
'program:contrail-snmp-collector/priority' : value => '340';
Expand Down

0 comments on commit de213a3

Please sign in to comment.