Contrail-discovery service returns 0 exit code when fails

Bug in upstream for this issue:
https://bugs.launchpad.net/opencontrail/+bug/1491872

Change-Id: Ic19e6cc9bf43c6fe40dd0ee913aaf4e4795891a7
Rally-Id: DE225249
This commit is contained in:
Andrey Kirilochkin 2016-08-03 14:35:47 -05:00 committed by Illia Polliul
parent 5d386b3aa7
commit d721199ddb
3 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:contrail_discovery_ini_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/contrail/supervisord_config_files/contrail-discovery.ini'
end
end

View File

@ -0,0 +1,44 @@
Puppet::Type.newtype(:contrail_discovery_ini_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/contrail/supervisord_config_files/contrail-discovery.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
newvalues(/^[\S ]*$/)
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

View File

@ -145,6 +145,23 @@ class contrail::config {
'DEFAULTS/ttl_short': value => '1';
'DNS-SERVER/policy': value => 'fixed';
}
contrail_discovery_ini_config {
'program:contrail-discovery/command': value => '/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --worker_id %(process_num)s';
'program:contrail-discovery/numprocs': value => '1';
'program:contrail-discovery/process_name': value => '%(process_num)s';
'program:contrail-discovery/redirect_stderr': value => true;
'program:contrail-discovery/stdout_logfile': value => '/var/log/contrail/contrail-discovery-%(process_num)s-stdout.log';
'program:contrail-discovery/stderr_logfile': value => '/dev/null';
'program:contrail-discovery/priority': value => '440';
'program:contrail-discovery/autostart': value => true;
'program:contrail-discovery/killasgroup': value => true;
'program:contrail-discovery/stopsignal': value => 'KILL';
'program:contrail-discovery/exitcodes': value => '123';
'program:contrail-discovery/startretries': value => '10';
'program:contrail-discovery/user': value => 'contrail';
}
contrail_keystone_auth_config {
'KEYSTONE/auth_host': value => $contrail::keystone_address;
'KEYSTONE/auth_protocol': value => $contrail::keystone_protocol;
@ -272,7 +289,10 @@ class contrail::config {
Class['::memcached']
],
}
Service['supervisor-config'] -> Contrail_api_ini_config <||>
Package['contrail-config'] -> Contrail_api_ini_config <||>
Package['contrail-config'] -> Contrail_discovery_ini_config <||>
Contrail_api_ini_config <||> ~> Service['supervisor-config']
Contrail_discovery_ini_config <||> ~> Service['supervisor-config']
Contrail_svc_monitor_config <||> ~> Service['supervisor-config']
Contrail_schema_config <||> ~> Service['supervisor-config']
Contrail_discovery_config <||> ~> Service['supervisor-config']