2014-05-16 09:52:50 -04:00
|
|
|
#
|
|
|
|
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
|
|
|
#
|
|
|
|
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
# == Class: keystone::cron::token_flush
|
|
|
|
#
|
|
|
|
# Installs a cron job to purge expired tokens.
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
2020-02-03 23:17:58 +01:00
|
|
|
# [*ensure*]
|
|
|
|
# (Optional) Valid values are present, absent.
|
|
|
|
# Defaults to 'present'
|
|
|
|
#
|
|
|
|
# [*minute*]
|
|
|
|
# (Optional) Minute.
|
|
|
|
# Defaults to '1'
|
|
|
|
#
|
|
|
|
# [*hour*]
|
|
|
|
# (Optional) Hour.
|
|
|
|
# Defaults to *
|
|
|
|
#
|
|
|
|
# [*monthday*]
|
|
|
|
# (Optional) Day of month.
|
|
|
|
# Defaults to '*'
|
|
|
|
#
|
|
|
|
# [*month*]
|
|
|
|
# (Optional) Month.
|
|
|
|
# Defaults to '*'
|
|
|
|
#
|
|
|
|
# [*weekday*]
|
|
|
|
# (Optional) Day of week.
|
|
|
|
# Defaults to '*'
|
|
|
|
#
|
|
|
|
# [*maxdelay*]
|
|
|
|
# (Optional) Max random delay in seconds. Should be a positive integer.
|
|
|
|
# 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.
|
|
|
|
# Defaults to 0
|
|
|
|
#
|
|
|
|
# [*destination*]
|
|
|
|
# (Optional) Path to file to which rows should be archived
|
|
|
|
# Defaults to '/var/log/keystone/keystone-tokenflush.log'
|
|
|
|
#
|
|
|
|
# [*user*]
|
|
|
|
# (Optional) Allow to run the crontab on behalf any user.
|
|
|
|
# Defaults to 'keystone'
|
2015-06-25 13:21:51 -04:00
|
|
|
#
|
2014-05-16 09:52:50 -04:00
|
|
|
class keystone::cron::token_flush (
|
2017-08-04 08:41:01 +03:00
|
|
|
$ensure = present,
|
|
|
|
$minute = 1,
|
|
|
|
$hour = '*',
|
|
|
|
$monthday = '*',
|
|
|
|
$month = '*',
|
|
|
|
$weekday = '*',
|
|
|
|
Integer $maxdelay = 0,
|
|
|
|
$destination = '/var/log/keystone/keystone-tokenflush.log',
|
|
|
|
$user = 'keystone',
|
2014-05-16 09:52:50 -04:00
|
|
|
) {
|
|
|
|
|
2019-12-08 23:09:22 +01:00
|
|
|
include keystone::deps
|
2016-02-23 18:31:15 -07:00
|
|
|
|
2014-11-26 18:02:42 +01:00
|
|
|
if $maxdelay == 0 {
|
|
|
|
$sleep = ''
|
|
|
|
} else {
|
|
|
|
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
|
|
|
|
}
|
|
|
|
|
2014-05-16 09:52:50 -04:00
|
|
|
cron { 'keystone-manage token_flush':
|
2014-11-26 18:02:42 +01:00
|
|
|
ensure => $ensure,
|
2015-08-04 17:26:04 +02:00
|
|
|
command => "${sleep}keystone-manage token_flush >>${destination} 2>&1",
|
2014-12-09 10:50:06 -05:00
|
|
|
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
2015-06-25 13:21:51 -04:00
|
|
|
user => $user,
|
2014-05-16 09:52:50 -04:00
|
|
|
minute => $minute,
|
|
|
|
hour => $hour,
|
|
|
|
monthday => $monthday,
|
|
|
|
month => $month,
|
2015-06-25 13:21:51 -04:00
|
|
|
weekday => $weekday,
|
2017-07-07 15:04:35 -06:00
|
|
|
require => Anchor['keystone::install::end'],
|
2014-05-16 09:52:50 -04:00
|
|
|
}
|
|
|
|
}
|