-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #667 from sarkapalkovicova/service-parametrization
feat(gen): kerberos_renewal_principals defines resource by destination file
- Loading branch information
Showing
3 changed files
with
64 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 30 additions & 10 deletions
40
slave/process-kerberos-renewal-principals/bin/process-kerberos_renewal_principals.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
#!/bin/bash | ||
|
||
PROTOCOL_VERSION='3.0.0' | ||
|
||
function process { | ||
|
||
DST_DIR="/etc/heimdal-kdc/krb525d.d/" | ||
DST_FILE="${SERVICE}.conf" | ||
FROM_PERUN="${WORK_DIR}/${SERVICE}" | ||
FROM_PERUN_DIR="${WORK_DIR}/kerberos_renewal_principals/" | ||
|
||
### Status codes | ||
I_CHANGED=(0 "${DST_FILE} updated") | ||
E_NOT_CHANGE=(50 "Cannot copy file ${FROM_PERUN} to ${DST_FILE}") | ||
I_EVERYTHING_OK=(0 'All files has been updated.') | ||
E_FINISHED_WITH_ERRORS=(50 'Slave script finished with errors!') | ||
|
||
ERROR=0 | ||
|
||
create_lock | ||
|
||
cp "${FROM_PERUN}" "${DST_DIR}/${DST_FILE}" | ||
# Delete all files with 'kerberos_renewal_principals prefix from destination directory | ||
if [[ $(find $DST_DIR -mindepth 1 -maxdepth 1 -name "kerberos_renewal_principals*") ]]; then | ||
if ! rm $DST_DIR/kerberos_renewal_principals*; then | ||
ERROR=1 | ||
fi | ||
fi | ||
|
||
if [ $? -eq 0 ]; then | ||
log_msg I_CHANGED | ||
# Copy all files from perun | ||
for FROM_PERUN_FILE in "$FROM_PERUN_DIR"/* | ||
do | ||
# Get name of file | ||
local FILE_NAME | ||
if ! FILE_NAME=$(basename "$FROM_PERUN_FILE"); then | ||
ERROR=1 | ||
continue | ||
fi | ||
|
||
# Copy file to destination dir | ||
if ! cp "${FROM_PERUN_FILE}" "${DST_DIR}/${FILE_NAME}.conf"; then | ||
ERROR=1 | ||
fi | ||
done | ||
|
||
if [ $ERROR -ne 0 ]; then | ||
log_msg E_FINISHED_WITH_ERRORS | ||
else | ||
log_msg E_NOT_CHANGED | ||
log_msg I_EVERYTHING_OK | ||
fi | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
perun-slave-process-kerberos-renewal-principals (3.0.1) stable; urgency=low | ||
|
||
* Handled receive of many files from perun. | ||
* Copies them to the destination directory and deletes unnecessary ones. | ||
|
||
-- Sarka Palkovicova <[email protected]> Tue, 1 Mar 2022 15:27:00 +0100 | ||
|
||
perun-slave-process-kerberos-renewal-principals (3.0.0) stable; urgency=low | ||
|
||
* added new service kerberos-renewal-principals | ||
|