Description of problem:
If you run katello-backup from cron then it fails with
'sorry, you must have a tty to run sudo'
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Put this line to crontab
33 15 * * * root /usr/bin/katello-backup /var/sat-content --online-backup --skip-pulp-content >> /var/log/satellite/backups.log 2>&1
Starting backup: 2018-01-27 15:33:02 +1100
Creating backup folder /var/sat-content/katello-backup-20180127153302
sudo: sorry, you must have a tty to run sudo
I also found that adding this line to /etc/sudoers help to avoid the error but this workaround is unacceptable in secured environments.
Created redmine issue http://projects.theforeman.org/issues/22551 from this bug
Upstream bug assigned to email@example.com
Reproduced it and the fix "Default !requiretty" in the /etc/sudoers violates our security protocols.
Added the below entry to /etc/crontab file on the Satellite6
00 09 * * * root /usr/sbin/satellite-backup -y /var/tmp/sat-content --online-backup --skip-pulp-content >> /var/log/satellite/backups.log 2>&1
Starting backup: 2018-08-01 09:00:02 -0400
Creating backup folder /var/tmp/sat-content/satellite-backup-20180801090002
Generating metadata ...
Backing up config files...
Backing up postgres online schema...
Backing up mongo online schema...
Done with backup: 2018-08-01 09:01:24 -0400
**** BACKUP Complete, contents can be found in: /var/tmp/sat-content/satellite-backup-20180801090002 ****
[root@testing-sat6 satellite-backup-20180801090002]# ls
candlepin.dump config_files.tar.gz foreman.dump metadata.yml mongo_dump pg_globals.dump
VERIFIED with sat6.3.3 snap2 build
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.