-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
license-check: remove timer-based license-check
- Loading branch information
1 parent
a9cb6af
commit db3da66
Showing
24 changed files
with
199 additions
and
482 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
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
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
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
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
sru/release-27.7/cleanup_failed_old_license_check_timer.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
series=$1 | ||
deb=$2 | ||
|
||
set -e | ||
|
||
GREEN="\e[32m" | ||
RED="\e[31m" | ||
BLUE="\e[36m" | ||
END_COLOR="\e[0m" | ||
|
||
function cleanup { | ||
lxc delete test --force | ||
} | ||
|
||
function on_err { | ||
echo -e "${RED}Test Failed${END_COLOR}" | ||
cleanup | ||
exit 1 | ||
} | ||
|
||
trap on_err ERR | ||
|
||
function print_and_run_cmd { | ||
echo -e "${BLUE}Running:${END_COLOR}" "$@" | ||
echo -e "${BLUE}Output:${END_COLOR}" | ||
lxc exec test -- sh -c "$@" | ||
echo | ||
} | ||
|
||
function explanatory_message { | ||
echo -e "${BLUE}$@${END_COLOR}" | ||
} | ||
|
||
explanatory_message "Starting $series container and updating ubuntu-advantage-tools" | ||
lxc launch ubuntu-daily:$series test >/dev/null 2>&1 | ||
sleep 10 | ||
|
||
lxc exec test -- apt-get update >/dev/null | ||
lxc exec test -- apt-get install -y ubuntu-advantage-tools locate >/dev/null | ||
print_and_run_cmd "ua version" | ||
explanatory_message "Start the timer to make sure its state is fixed on upgrade" | ||
print_and_run_cmd "systemctl start ua-license-check.timer" | ||
print_and_run_cmd "systemctl status ua-license-check.timer" | ||
|
||
explanatory_message "installing new version of ubuntu-advantage-tools from local copy" | ||
lxc file push $deb test/tmp/ua.deb > /dev/null | ||
print_and_run_cmd "dpkg -i /tmp/ua.deb" | ||
print_and_run_cmd "ua version" | ||
|
||
explanatory_message "systemd should not list the timer as failed" | ||
print_and_run_cmd "systemctl status ua-license-check.timer || true" | ||
print_and_run_cmd "systemctl --no-pager | grep ua-license-check || true" | ||
result=$(lxc exec test -- sh -c "systemctl --no-pager | grep ua-license-check.timer" || true) | ||
echo "$result" | grep -qv "ua-license-check.timer\s\+not-found\s\+failed" | ||
|
||
echo -e "${GREEN}Test Passed${END_COLOR}" | ||
cleanup |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
series=$1 | ||
deb=$2 | ||
|
||
set -e | ||
|
||
GREEN="\e[32m" | ||
RED="\e[31m" | ||
BLUE="\e[36m" | ||
END_COLOR="\e[0m" | ||
|
||
function cleanup { | ||
lxc delete test --force | ||
} | ||
|
||
function on_err { | ||
echo -e "${RED}Test Failed${END_COLOR}" | ||
cleanup | ||
exit 1 | ||
} | ||
|
||
trap on_err ERR | ||
|
||
function print_and_run_cmd { | ||
echo -e "${BLUE}Running:${END_COLOR}" "$@" | ||
echo -e "${BLUE}Output:${END_COLOR}" | ||
lxc exec test -- sh -c "$@" | ||
echo | ||
} | ||
|
||
function explanatory_message { | ||
echo -e "${BLUE}$@${END_COLOR}" | ||
} | ||
|
||
explanatory_message "Starting $series container and updating ubuntu-advantage-tools" | ||
lxc launch ubuntu-daily:$series test >/dev/null 2>&1 | ||
sleep 10 | ||
|
||
lxc exec test -- apt-get update >/dev/null | ||
lxc exec test -- apt-get install -y ubuntu-advantage-tools locate >/dev/null | ||
print_and_run_cmd "ua version" | ||
explanatory_message "Note where all license-check artifacts are before upgrade" | ||
print_and_run_cmd "updatedb" | ||
print_and_run_cmd "locate ua-license-check" | ||
|
||
explanatory_message "installing new version of ubuntu-advantage-tools from local copy" | ||
lxc file push $deb test/tmp/ua.deb > /dev/null | ||
print_and_run_cmd "dpkg -i /tmp/ua.deb" | ||
print_and_run_cmd "ua version" | ||
|
||
explanatory_message "license-check artifacts should be gone" | ||
print_and_run_cmd "updatedb" | ||
print_and_run_cmd "locate ua-license-check || true" | ||
result=$(lxc exec test -- locate ua-license-check || true) | ||
test -z "$result" | ||
|
||
echo -e "${GREEN}Test Passed${END_COLOR}" | ||
cleanup |
Oops, something went wrong.