79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'manifests/cron/archive_deleted_rows.pp', line 79
class nova::cron::archive_deleted_rows (
$minute = 1,
$hour = 0,
$monthday = '*',
$month = '*',
$weekday = '*',
$max_rows = '100',
$user = undef,
$destination = '/var/log/nova/nova-rowsflush.log',
$until_complete = false,
$purge = false,
$maxdelay = 0,
$all_cells = false,
$age = undef,
) {
include nova::deps
include nova::params
if $until_complete {
$until_complete_real = '--until-complete'
}
else {
$until_complete_real = ''
}
if $purge {
$purge_real = '--purge'
}
else {
$purge_real = ''
}
if $all_cells {
$all_cells_real = '--all-cells'
}
else {
$all_cells_real = ''
}
if $maxdelay == 0 {
$sleep = ''
} else {
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
}
if $age {
$age_real = "--before `date --date=\'today - ${age} days\' +\\%F`"
} else {
$age_real = ''
}
$cron_cmd = 'nova-manage db archive_deleted_rows'
cron { 'nova-manage db archive_deleted_rows':
command => "${sleep}${cron_cmd} ${purge_real} --max_rows ${max_rows} ${age_real} ${until_complete_real} \
${all_cells_real} >>${destination} 2>&1",
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
user => pick($user, $::nova::params::nova_user),
minute => $minute,
hour => $hour,
monthday => $monthday,
month => $month,
weekday => $weekday,
require => Anchor['nova::dbsync::end']
}
}
|