rackerlabs/auter

Release 0.12 - Testing required: Ubuntu 18.04

reaperzn opened this issue · 2 comments

This issue has been raised as part of the release process for Version 0.12

Please could auter be fully tested on the OS mentioned in the title of this issue.

Notes:

  • Please assign yourself to the issue ONLY IF you are actively working on it
  • Please ensure you are testing the code from the v0.12 branch of this repo
  • Follow the testing guide from https://github.com/rackerlabs/auter/blob/develop/HACKING.md
  • Any problems should be documented in this issue
  • If there are changes required, after the issue has been validated, a new issue should be raised and linked referenced in this issue

NOT FINISHED. Have done manual run.

INSTALL

PASS

root@ubuntu18:~/auter/tests# apt install docker.io
root@ubuntu18:~/auter/tests# sed -i 's/16.04 17.10 18.04/18.04/g' 20-debuild.sh
root@ubuntu18:~/auter/tests# ./20-debuild.sh
AUTERDIR: /root/auter
AUTERPARENTDIR: /root
VERSION: 0.12
Unable to find image 'ubuntu:18.04' locally
18.04: Pulling from library/ubuntu
[...]
Digest: sha256:30e04ddada6eb09c12330c7df72cad1573916c7100168c34076808169ff6d805
Status: Downloaded newer image for ubuntu:18.04
 [ PASSED ] Created 18.04 docker image
 [ PASSED ] Updated apt cache in docker image devscripts build-essential lintian
 [ PASSED ] Installed apt-utils
 [ PASSED ] Installed sudo
 [ PASSED ] Installed git
 [ PASSED ] Installed make
 [ PASSED ] Installed help2man
 [ PASSED ] Installed lsb-release
 [ PASSED ] Installed lintian
 [ PASSED ] Installed devscripts
 [ PASSED ] Installed debhelper
 [ PASSED ] Added build user
 [ PASSED ] Created source tarball from travis container
 [ PASSED ] Moved sources tarball from /root to /root/auter
 [ PASSED ] Copied sources to docker container
 [ PASSED ] Copied build script to container
I am root... Handing over to builduser
I am builduser... I am building

# DON'T FORGET TO CHANGE THIS VERSION AT NEXT RELEASE
dpkg: warning: failed to open configuration file '/root/.dpkg.cfg' for reading: Permission denied
 [ PASSED ] Executed /home/builduser/21-container-debuild.sh
 [ PASSED ] Copied auter.deb.tar.gz to travis container
 [ PASSED ] Extracted auter.deb.tar.gz on travis container
auter_0.12_all.deb
auter_0.12_all.deb
 [ PASSED ] New package extracted to /root/auter/tests/packages/auter_0.12_all.deb
auter-debuild-test-18.04

root@ubuntu18:~/auter/tests/packages# apt install ./auter_0.12_all.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'auter' instead of './auter_0.12_all.deb'
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  auter
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/12.6 kB of archives.
After this operation, 58.4 kB of additional disk space will be used.
Get:1 /root/auter/tests/packages/auter_0.12_all.deb auter all 0.12 [12.6 kB]
Selecting previously unselected package auter.
(Reading database ... 61141 files and directories currently installed.)
Preparing to unpack .../packages/auter_0.12_all.deb ...
Unpacking auter (0.12) ...
Setting up auter (0.12) ...
INFO: auter enabled
Processing triggers for man-db (2.8.3-2) ...
N: Download is performed unsandboxed as root as file '/root/auter/tests/packages/auter_0.12_all.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

Basic Checks

FAIL No man page for auter.conf

root@ubuntu18:~/auter/tests/packages# auter --status
auter is currently enabled and not running
root@ubuntu18:~/auter/tests/packages# auter --disable
INFO: auter disabled
root@ubuntu18:~/auter/tests/packages# auter --status
auter is currently disabled
root@ubuntu18:~/auter/tests/packages# auter --enable
INFO: auter enabled
root@ubuntu18:~/auter/tests/packages# auter --status
auter is currently enabled and not running

root@ubuntu18:~/auter/tests/packages# auter --help

Usage: auter [--enable|--disable|--status] [--prep] [--apply] [--reboot] [--postreboot] [OPTIONS]

Automatic Update Transaction Execution by Rackspace. A wrapper around cron and yum/dnf/apt to manage system updates with the ability to configure automatic reboots and custom scripts.

Actions:
  --enable      Enable auter
  --disable     Disable auter. Also deletes unused pidfile if it exists
  --status      Show whether enabled or disabled
  --prep        Pre-download updates before applying
  --apply       Apply updates, and reboot if AUTOREBOOT=yes
  --reboot      Reboot system including pre/post reboot scripts
  --postreboot  Run post reboot script

Options:
  --config=FILE Specify the full path to an auter config file. Defaults to /etc/auter/auter.conf
  --stdout      Always log to STDOUT, regardless of not having a tty
  --skip-all-scripts
                Skip the executions of all custom scripts (Default in /etc/auter/*.d/)

  --skip-scripts-by-phase=PHASE
                Skip the execution of the custom scripts for the specified phase. You can specify myltiple phases.

                Valid Phases: pre-prep, post-prep, pre-apply, post-apply, pre-reboot, post-reboot.

                Example: --skip-scripts-by-phase="pre-prep,post-apply,pre-reboot"

  --skip-scripts-by-name=SCRIPTNAME
                Skip specific scripts by name. You can specify myltiple phases.

                Example: --skip-scripts-by-name="10-configsnap-pre, 20-startApp.sh"

  --no-wall	If possible, suppress shutdown wall messages in the reboot phase
  -h, --help    Show this help text
  -v, --version Show the version

root@ubuntu18:~/auter/tests/packages# auter --version
auter 0.12

root@ubuntu18:~/auter/tests/packages# man auter; echo $?
0
root@ubuntu18:~/auter/tests/packages# man auter.conf; echo $?
No manual entry for auter.conf
16
root@ubuntu18:~/auter/tests/packages# man -k auter
auter (1)            - Automatic Update Transaction Execution by Rackspace

Manual Run

/var/cache/auter/default not populated

root@ubuntu18:~/auter/tests/packages# apt-get install openssl=1.1.0g-2ubuntu4
[...]
The following packages will be DOWNGRADED:
  openssl
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 4 not upgraded.

root@ubuntu18:~/auter/tests/packages# echo 'logger custom pre prep script ran' > /etc/auter/pre-prep.d/pre_prep_script
root@ubuntu18:~/auter/tests/packages# echo 'logger custom post prep script ran' > /etc/auter/post-prep.d/post_prep_script
root@ubuntu18:~/auter/tests/packages# echo 'logger custom pre apply script ran' > /etc/auter/pre-apply.d/pre_apply_script
root@ubuntu18:~/auter/tests/packages# echo 'logger custom post apply script ran' > /etc/auter/post-apply.d/pre_apply_script
root@ubuntu18:~/auter/tests/packages# echo 'logger custom pre reboot script ran' > /etc/auter/pre-reboot.d/pre_reboot_script
root@ubuntu18:~/auter/tests/packages# echo 'logger custom post reboot script ran' > /etc/auter/post-reboot.d/post_reboot_script
root@ubuntu18:~/auter/tests/packages# chmod +x /etc/auter/*.d/*script

root@ubuntu18:~/auter/tests/packages# egrep -v "^$|^#" /etc/auter/auter.conf
CONFIGSET="default"
AUTOREBOOT="no"
PACKAGEMANAGEROPTIONS=""
PREDOWNLOADUPDATES="yes"
ONLYINSTALLFROMPREP="no"
MAXDELAY="3600"
PACKAGEMANAGERLOCKWAITTIME="60"
PACKAGEMANAGERLOCKRETRIES="5"
PREPREPSCRIPTDIR="/etc/auter/pre-prep.d"
POSTPREPSCRIPTDIR="/etc/auter/post-prep.d"
PREAPPLYSCRIPTDIR="/etc/auter/pre-apply.d"
POSTAPPLYSCRIPTDIR="/etc/auter/post-apply.d"
PREREBOOTSCRIPTDIR="/etc/auter/pre-reboot.d"
POSTREBOOTSCRIPTDIR="/etc/auter/post-reboot.d"

root@ubuntu18:~/auter/tests/packages# auter --prep
INFO: Running with: /usr/sbin/auter --prep
INFO: Running in an interactive shell, disabling all random sleeps
INFO: Running Pre-Prep script /etc/auter/pre-prep.d/pre_prep_script
INFO: Updates downloaded
INFO: Running Post-Prep script /etc/auter/post-prep.d/post_prep_script

root@ubuntu18:~/auter/tests/packages# cat /var/lib/auter/last-prep-output-default
[...]
The following packages will be upgraded:
  linux-headers-generic linux-headers-virtual linux-image-virtual
  linux-virtual openssl
5 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/33.5 MB of archives.
After this operation, 164 MB of additional disk space will be used.
Download complete and in download only mode

root@ubuntu18:~/auter/tests/packages# auter --apply
INFO: Running with: /usr/sbin/auter --apply
INFO: Running in an interactive shell, disabling all random sleeps
INFO: Running Pre-Apply script /etc/auter/pre-apply.d/pre_apply_script
INFO: Applying updates
Trying to update
INFO: Updates complete. You may need to reboot for some updates to take effect
INFO: Auter successfully ran at 2018-07-18T16:09:44+00:00
INFO: Running Post-Apply script /etc/auter/post-apply.d/pre_apply_script

root@ubuntu18:~/auter/tests/packages# apt-get upgrade
[...]
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

root@ubuntu18:~/auter/tests/packages# cat /var/lib/auter/last-apply-output-default
[...]
The following packages will be upgraded:
  openssl
1 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/532 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 62505 files and directories currently installed.)
Preparing to unpack .../openssl_1.1.0g-2ubuntu4.1_amd64.deb ...
Unpacking openssl (1.1.0g-2ubuntu4.1) over (1.1.0g-2ubuntu4) ...
Setting up openssl (1.1.0g-2ubuntu4.1) ...
Processing triggers for man-db (2.8.3-2) ...

root@ubuntu18:~/auter/tests/packages# auter --reboot
INFO: Running with: /usr/sbin/auter --reboot
INFO: Running in an interactive shell, disabling all random sleeps
INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/pre_reboot_script
INFO: Adding post-reboot-hook to run scripts under /etc/auter/post-reboot.d to /etc/cron.d/auter-postreboot-default
INFO: Rebooting server
root@ubuntu18:~/auter/tests/packages# Shared connection to XXXXXXXXX closed.

root@ubuntu18:~# grep "custom " /var/log/syslog
Jul 18 16:06:03 ubuntu18 root: custom pre prep script ran
Jul 18 16:06:06 ubuntu18 root: custom post prep script ran
Jul 18 16:09:41 ubuntu18 root: custom pre apply script ran
Jul 18 16:09:44 ubuntu18 root: custom post apply script ran
Jul 18 16:17:56 ubuntu18 root: custom pre reboot script ran
Jul 18 16:25:34 ubuntu18 root: custom post reboot script ran

Test 3: Updates via cron - default config with --stdout option [ PASS ]

Config settings

  1. egrep -v "^$|^#" /etc/auter/auter.conf
root@ubuntu18:# egrep -v "^$|^#" /etc/auter/auter.conf
CONFIGSET="default"
AUTOREBOOT="no"
PACKAGEMANAGEROPTIONS=""
PREDOWNLOADUPDATES="yes"
ONLYINSTALLFROMPREP="no"
MAXDELAY="3600"
PACKAGEMANAGERLOCKWAITTIME="60"
PACKAGEMANAGERLOCKRETRIES="5"
PREPREPSCRIPTDIR="/etc/auter/pre-prep.d"
POSTPREPSCRIPTDIR="/etc/auter/post-prep.d"
PREAPPLYSCRIPTDIR="/etc/auter/pre-apply.d"
POSTAPPLYSCRIPTDIR="/etc/auter/post-apply.d"
PREREBOOTSCRIPTDIR="/etc/auter/pre-reboot.d"
POSTREBOOTSCRIPTDIR="/etc/auter/post-reboot.d"
  1. Prepare custom scripts: Execute:
    echo 'logger custom pre prep script ran' > /etc/auter/pre-prep.d/pre_prep_script
    echo 'logger custom post prep script ran' > /etc/auter/post-prep.d/post_prep_script
    echo 'logger custom pre apply script ran' > /etc/auter/pre-apply.d/pre_apply_script
    echo 'logger custom post apply script ran' > /etc/auter/post-apply.d/pre_apply_script
    echo 'logger custom pre reboot script ran' > /etc/auter/pre-reboot.d/pre_reboot_script
    echo 'logger custom post reboot script ran' > /etc/auter/post-reboot.d/post_reboot_script
    chmod +x /etc/auter/*.d/*script
  1. Adjust the MAXDELAY value to avoid extented sleep times
root@ubuntu18:# sed -i 's/MAXDELAY.*$/MAXDELAY="60"/g' /etc/auter/auter.conf
  1. Schedule a cron job for prep to run in 5 minutes and watch the logs:
    echo "$(date --date="5 minutes" +%_M" "%_H" "%d" "%_m" *") root $(which auter) --prep --stdout" > /etc/cron.d/auter-prep

After auter has completed the prep:

  • [ pass ] Expected logs:
        auter: INFO: Running with: /usr/bin/auter --prep --stdout
        auter: INFO: Running Pre-Prep script /etc/auter/pre-prep.d/pre_prep_script
        root: custom pre prep script ran
        auter: INFO: Updates downloaded
        auter: INFO: Running Post-Prep script /etc/auter/post-prep.d/post_prep_scrip
        root: custom post prep script ran
  • [ pass ] /var/lib/auter/last-prep-output-default contains yum download-only output
root@ubuntu18:# tail -n 2 /var/lib/auter/last-prep-output-default
Fetched 34.3 MB in 2s (15.7 MB/s)
Download complete and in download only mode
  • [ pass ] updates downloaded to /var/cache/yum/…
root@ubuntu18:# ls -al /var/cache/apt/archives/ | wc -l
170
  • [ pass ] pre/post prep scripts ran successfully with messages logged to syslog
  • [ pass ] mail sent to root user with stdout output from auter. Debian will log stdout to syslog rather than mail
    Output from logs:
root@ubuntu18:# tail -n0 -f /var/log/syslog
Aug  2 12:57:01 ubuntu18 CRON[23184]: (root) CMD (/usr/sbin/auter --prep --stdout)
Aug  2 12:57:01 ubuntu18 auter: INFO: Running with: /usr/sbin/auter --prep --stdout
Aug  2 12:57:01 ubuntu18 auter: INFO: Running Pre-Prep script /etc/auter/pre-prep.d/pre_prep_script
Aug  2 12:57:01 ubuntu18 root: custom pre prep script ran
Aug  2 12:57:51 ubuntu18 auter: INFO: Updates downloaded
Aug  2 12:57:51 ubuntu18 auter: INFO: Running Post-Prep script /etc/auter/post-prep.d/post_prep_script
Aug  2 12:57:51 ubuntu18 root: custom post prep script ran
Aug  2 12:57:51 ubuntu18 CRON[23183]: (CRON) info (No MTA installed, discarding output)
  1. Schedule a cron job for apply to run in 5 minutes and watch the logs:
    echo "$(date --date="5 minutes" +%_M" "%_H" "%d" "%_m" *") root $(which auter) --apply --stdout" > /etc/cron.d/auter-apply
    tail -n0 -f /var/log/messages
After auter has completed the apply:
  • [ pass ] Expected logs:
        auter: INFO: Running with: /usr/bin/auter --apply --stdout
        auter: INFO: Running Pre-Apply script /etc/auter/pre-apply.d/pre_apply_script
        root: custom pre apply script ran
        auter: INFO: Applying updates
        auter: INFO: Running Post-Apply script /etc/auter/post-apply.d/pre_apply_script
        root: custom post apply script ran
        auter: INFO: Updates complete (yum Transaction ID : 86). You may need to reboot for some updates to take effect
        auter: INFO: Auter successfully ran at 2018-07-18T14:59:24+0000
  • [ pass ] no updates available after running
  • [ pass ] pre/post scripts ran successfully with messages logged to syslog
  • [ pass ] mail sent to root user with stdout output from auter. Debian will log stdout to syslog rather than mail
    Output from logs:
Aug  2 18:05:01 ubuntu18 CRON[300]: (root) CMD (/usr/sbin/auter --apply --stdout)
Aug  2 18:05:01 ubuntu18 auter: INFO: Running with: /usr/sbin/auter --apply --stdout
Aug  2 18:05:02 ubuntu18 auter: INFO: Running Pre-Apply script /etc/auter/pre-apply.d/pre_apply_script
Aug  2 18:05:02 ubuntu18 root: custom pre apply script ran
Aug  2 18:05:33 ubuntu18 auter: INFO: Applying updates
[...]
Aug  2 18:06:24 ubuntu18 auter: INFO: Updates complete. You may need to reboot for some updates to take effect
Aug  2 18:06:24 ubuntu18 auter: INFO: Auter successfully ran at 2018-08-02T18:06:24+00:00
Aug  2 18:06:24 ubuntu18 auter: INFO: Running Post-Apply script /etc/auter/post-apply.d/pre_apply_script
Aug  2 18:06:24 ubuntu18 root: custom post apply script ran
Aug  2 18:06:24 ubuntu18 CRON[32767]: (CRON) info (No MTA installed, discarding output)
  1. Schedule a cron job to run auter --reboot in 5 minutes and watch the logs:
    echo "$(date --date="5 minutes" +%_M" "%_H" "%d" "%_m" *") root $(which auter) --reboot --stdout" > /etc/cron.d/auter-reboot
    tail -n0 -f /var/log/messages
  • [ pass ] Expected logs:
        INFO: Running with: /usr/bin/auter --reboot --stdout
        INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/98-configsnap-pre-reboot
        INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/pre_reboot_script
        custom pre reboot script ran
        INFO: Adding post-reboot-hook to run scripts under /etc/auter/post-reboot.d to /etc/cron.d/auter-postreboot-default
        INFO: Rebooting server
  • [ pass ] pre-reboot scripts ran successfully
  • [ pass ] Wall message is printed
  • [ pass ] mail sent to root user with stdout output from auter. Debian will log stdout to syslog rather than mail
  • [ pass ] Server reboots
    Output from logs:
root@ubuntu18:# tail -n0 -f /var/log/syslog
Aug  2 18:12:01 ubuntu18 CRON[11760]: (root) CMD (/usr/sbin/auter --reboot --stdout)
Aug  2 18:12:01 ubuntu18 auter: INFO: Running with: /usr/sbin/auter --reboot --stdout
Aug  2 18:12:01 ubuntu18 auter: INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/pre_reboot_script
Aug  2 18:12:01 ubuntu18 root: custom pre reboot script ran
Aug  2 18:12:01 ubuntu18 auter: INFO: Adding post-reboot-hook to run scripts under /etc/auter/post-reboot.d to /etc/cron.d/auter-postreboot-default
Aug  2 18:12:01 ubuntu18 auter: INFO: Rebooting server
Aug  2 18:12:01 ubuntu18 CRON[11759]: (CRON) info (No MTA installed, discarding output)

Broadcast message from root@ubuntu18 (Thu 2018-08-02 18:12:01 UTC):

auter: System reboot to apply updates
The system is going down for reboot at Thu 2018-08-02 18:14:01 UTC!


Broadcast message from root@ubuntu18 (Thu 2018-08-02 18:13:01 UTC):

auter: System reboot to apply updates
The system is going down for reboot at Thu 2018-08-02 18:14:01 UTC!
  1. After the server has booted, it may take up to 2 minutes for auter logs to appear. watch the logs:
    egrep "auter:|custom" /var/log/messages | awk '/auter --reboot/,0'
  • [ pass ] Expected logs:
        auter: INFO: Running with: /usr/bin/auter --reboot --stdout
        auter: INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/pre_reboot_script
        root: custom pre reboot script ran
        auter: INFO: Adding post-reboot-hook to run scripts under /etc/auter/post-reboot.d to /etc/cron.d/auter-postreboot-default
        auter: INFO: Rebooting server
        auter: INFO: Running with: /usr/bin/auter --postreboot --config /etc/auter/auter.conf
        auter: INFO: Removed post-reboot hook: /etc/cron.d/auter-postreboot-default
        auter: INFO: Running Post-Reboot script /etc/auter/post-reboot.d/post_reboot_script
        root: custom post reboot script ran
  • [ pass ] post-reboot scripts ran successfully
  • [ pass ] output from auter also mailed to the root user on CentOS, output logged to syslog on Fedora
    Output from logs:
    root@ubuntu18:# egrep "auter:|custom" /var/log/syslog | awk '/auter --reboot/,0'
Aug  2 18:12:01 ubuntu18 auter: INFO: Running with: /usr/sbin/auter --reboot --stdout
Aug  2 18:12:01 ubuntu18 auter: INFO: Running Pre-Reboot script /etc/auter/pre-reboot.d/pre_reboot_script
Aug  2 18:12:01 ubuntu18 root: custom pre reboot script ran
Aug  2 18:12:01 ubuntu18 auter: INFO: Adding post-reboot-hook to run scripts under /etc/auter/post-reboot.d to /etc/cron.d/auter-postreboot-default
Aug  2 18:12:01 ubuntu18 auter: INFO: Rebooting server
Aug  2 18:14:52 ubuntu18 auter: INFO: Running with: /usr/sbin/auter --postreboot --config /etc/auter/auter.conf
Aug  2 18:14:52 ubuntu18 auter: INFO: Removed post-reboot hook: /etc/cron.d/auter-postreboot-default
Aug  2 18:19:39 ubuntu18 auter: INFO: Running Post-Reboot script /etc/auter/post-reboot.d/post_reboot_script
Aug  2 18:19:39 ubuntu18 root: custom post reboot script ran