Merge "Deprecate keystone::cron::token_fush"
This commit is contained in:
commit
b0e2c76684
|
@ -30,7 +30,6 @@ class { 'keystone':
|
||||||
catalog_type => 'sql',
|
catalog_type => 'sql',
|
||||||
enabled => true,
|
enabled => true,
|
||||||
}
|
}
|
||||||
class { 'keystone::cron::token_flush': }
|
|
||||||
class { 'keystone::bootstrap':
|
class { 'keystone::bootstrap':
|
||||||
password => 'ChangeMe',
|
password => 'ChangeMe',
|
||||||
public_url => "https://${::fqdn}:443/main",
|
public_url => "https://${::fqdn}:443/main",
|
||||||
|
|
|
@ -17,78 +17,61 @@
|
||||||
#
|
#
|
||||||
# == Class: keystone::cron::token_flush
|
# == Class: keystone::cron::token_flush
|
||||||
#
|
#
|
||||||
|
# DEPRECATED!
|
||||||
# Installs a cron job to purge expired tokens.
|
# Installs a cron job to purge expired tokens.
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters
|
||||||
#
|
#
|
||||||
# [*ensure*]
|
# [*ensure*]
|
||||||
# (Optional) Valid values are present, absent.
|
# (Optional) Valid values are present, absent.
|
||||||
# Defaults to 'present'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*minute*]
|
# [*minute*]
|
||||||
# (Optional) Minute.
|
# (Optional) Minute.
|
||||||
# Defaults to '1'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*hour*]
|
# [*hour*]
|
||||||
# (Optional) Hour.
|
# (Optional) Hour.
|
||||||
# Defaults to *
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*monthday*]
|
# [*monthday*]
|
||||||
# (Optional) Day of month.
|
# (Optional) Day of month.
|
||||||
# Defaults to '*'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*month*]
|
# [*month*]
|
||||||
# (Optional) Month.
|
# (Optional) Month.
|
||||||
# Defaults to '*'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*weekday*]
|
# [*weekday*]
|
||||||
# (Optional) Day of week.
|
# (Optional) Day of week.
|
||||||
# Defaults to '*'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*maxdelay*]
|
# [*maxdelay*]
|
||||||
# (Optional) Max random delay in seconds. Should be a positive integer.
|
# (Optional) Max random delay in seconds. Should be a positive integer.
|
||||||
# Induces a random delay before running the cronjob to avoid running all
|
# Induces a random delay before running the cronjob to avoid running all
|
||||||
# cron jobs at the same time on all hosts this job is configured.
|
# cron jobs at the same time on all hosts this job is configured.
|
||||||
# Defaults to 0
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*destination*]
|
# [*destination*]
|
||||||
# (Optional) Path to file to which rows should be archived
|
# (Optional) Path to file to which rows should be archived
|
||||||
# Defaults to '/var/log/keystone/keystone-tokenflush.log'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*user*]
|
# [*user*]
|
||||||
# (Optional) Allow to run the crontab on behalf any user.
|
# (Optional) Allow to run the crontab on behalf any user.
|
||||||
# Defaults to 'keystone'
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
class keystone::cron::token_flush (
|
class keystone::cron::token_flush (
|
||||||
$ensure = present,
|
$ensure = undef,
|
||||||
$minute = 1,
|
$minute = undef,
|
||||||
$hour = '*',
|
$hour = undef,
|
||||||
$monthday = '*',
|
$monthday = undef,
|
||||||
$month = '*',
|
$month = undef,
|
||||||
$weekday = '*',
|
$weekday = undef,
|
||||||
Integer $maxdelay = 0,
|
$maxdelay = undef,
|
||||||
$destination = '/var/log/keystone/keystone-tokenflush.log',
|
$destination = undef,
|
||||||
$user = 'keystone',
|
$user = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include keystone::deps
|
warning('The keystone::cron::token_flush class is deprecated and has no effect')
|
||||||
|
|
||||||
if $maxdelay == 0 {
|
|
||||||
$sleep = ''
|
|
||||||
} else {
|
|
||||||
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
|
|
||||||
}
|
|
||||||
|
|
||||||
cron { 'keystone-manage token_flush':
|
|
||||||
ensure => $ensure,
|
|
||||||
command => "${sleep}keystone-manage token_flush >>${destination} 2>&1",
|
|
||||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
||||||
user => $user,
|
|
||||||
minute => $minute,
|
|
||||||
hour => $hour,
|
|
||||||
monthday => $monthday,
|
|
||||||
month => $month,
|
|
||||||
weekday => $weekday,
|
|
||||||
require => Anchor['keystone::install::end'],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``keystone::cron::token_flush`` class has been deprcated and has no
|
||||||
|
effect.
|
|
@ -82,10 +82,6 @@ describe 'keystone server running with Apache/WSGI as Identity Provider' do
|
||||||
it { is_expected.to be_listening }
|
it { is_expected.to be_listening }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe cron do
|
|
||||||
it { is_expected.to have_entry('1 * * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
||||||
it 'should find beaker user' do
|
it 'should find beaker user' do
|
||||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
||||||
|
|
|
@ -80,10 +80,6 @@ describe 'keystone server running with Apache/WSGI as Service Provider with Shib
|
||||||
it { is_expected.to be_listening }
|
it { is_expected.to be_listening }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe cron do
|
|
||||||
it { is_expected.to have_entry('1 * * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
||||||
it 'should find beaker user' do
|
it 'should find beaker user' do
|
||||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
||||||
|
|
|
@ -76,10 +76,6 @@ describe 'keystone server running with Apache/WSGI with resources' do
|
||||||
it { is_expected.to be_listening }
|
it { is_expected.to be_listening }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe cron do
|
|
||||||
it { is_expected.to have_entry('1 * * * * keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1').with_user('keystone') }
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
shared_examples_for 'keystone user/tenant/service/role/endpoint resources using v3 API' do |auth_creds|
|
||||||
it 'should find beaker user' do
|
it 'should find beaker user' do
|
||||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 user list") do |r|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe 'keystone::cron::token_flush' do
|
|
||||||
let :params do
|
|
||||||
{}
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples 'keystone::cron::token_flush' do
|
|
||||||
context 'with default parameters' do
|
|
||||||
it { is_expected.to contain_class('keystone::deps') }
|
|
||||||
|
|
||||||
it { is_expected.to contain_cron('keystone-manage token_flush').with(
|
|
||||||
:ensure => 'present',
|
|
||||||
:command => 'keystone-manage token_flush >>/var/log/keystone/keystone-tokenflush.log 2>&1',
|
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
||||||
:user => 'keystone',
|
|
||||||
:minute => 1,
|
|
||||||
:hour => '*',
|
|
||||||
:monthday => '*',
|
|
||||||
:month => '*',
|
|
||||||
:weekday => '*',
|
|
||||||
:require => 'Anchor[keystone::install::end]',
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with overriden params' do
|
|
||||||
before do
|
|
||||||
params.merge!( :ensure => 'absent',
|
|
||||||
:minute => 13,
|
|
||||||
:hour => 23,
|
|
||||||
:monthday => 3,
|
|
||||||
:month => 4,
|
|
||||||
:weekday => 2,
|
|
||||||
:maxdelay => 600,
|
|
||||||
:destination => '/tmp/tokenflush.log',
|
|
||||||
:user => 'nobody' )
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to contain_class('keystone::deps') }
|
|
||||||
|
|
||||||
it { is_expected.to contain_cron('keystone-manage token_flush').with(
|
|
||||||
:ensure => params[:ensure],
|
|
||||||
:command => "sleep `expr ${RANDOM} \\% #{params[:maxdelay]}`; keystone-manage token_flush >>#{params[:destination]} 2>&1",
|
|
||||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
|
||||||
:user => params[:user],
|
|
||||||
:minute => params[:minute],
|
|
||||||
:hour => params[:hour],
|
|
||||||
:monthday => params[:monthday],
|
|
||||||
:month => params[:month],
|
|
||||||
:weekday => params[:weekday],
|
|
||||||
:require => 'Anchor[keystone::install::end]',
|
|
||||||
)}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
on_supported_os({
|
|
||||||
:supported_os => OSDefaults.get_supported_os
|
|
||||||
}).each do |os,facts|
|
|
||||||
context "on #{os}" do
|
|
||||||
let (:facts) do
|
|
||||||
facts.merge!(OSDefaults.get_facts({}))
|
|
||||||
end
|
|
||||||
|
|
||||||
it_behaves_like 'keystone::cron::token_flush'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue