Project

General

Profile

Bug #16961

katello-clean-empty-puppet-environments cron.weekly job needs to hide errors when trying to delete non-existent folders

Added by Craig Donnelly over 5 years ago. Updated almost 4 years ago.

Status:
Duplicate
Priority:
Low
Category:
Tooling
Target version:
Difficulty:
trivial
Triaged:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Description of problem:
The cron.weekly job put in place to clean empty puppet environments will now have situations where there are no KT_* environments to clean up. In this situation, the find command fails and an error is output. We should redirect the errors to null (hide them) or come up with a different command.

Version-Release number of selected component (if applicable):
Satellite 6.2.2.1

How reproducible:
100%

Steps to Reproduce:
1. Install Satellite 6.2
2. Have no publshed puppet environments. (KT_* folders are no longer created for content-views, so on if not modules are published)
3. Run /etc/cron.weekly/katello-clean-empty-puppet-environments

Actual results:
find: ‘/etc/puppet/environments/KT*’: No such file or directory

Expected results:
No errors from script output

Additional info:
Since the only purpose is to clean out unused puppet environments, we could simply add '> /dev/null 2>&1' to the end of the scripts `find` command, which will dismiss any and all errors.
If we want to retain errors for other issues, we can simply check for directory existence before-hand with simple if statements.

History

#1 Updated by Craig Donnelly over 5 years ago

I just noticed upstream this was already taken care of with the below being the current check:

$ cat katello-clean-empty-puppet-environments
#!/bin/bash

  1. Puppet 4
    [ -d /etc/puppetlabs/code/environments ] && find /etc/puppetlabs/code/environments/KT* -maxdepth 0 -type d -empty -delete
  1. Puppet 3
    [ -d /etc/puppet/environments ] && find /etc/puppet/environments/KT* -maxdepth 0 -type d -empty -delete

This can be closed out.

#2 Updated by Chris Roberts over 5 years ago

  • Status changed from New to Duplicate

#3 Updated by Chris Roberts over 5 years ago

  • Legacy Backlogs Release (now unused) set to 166

Also available in: Atom PDF