Merge ~bladernr/maas-cert-server:fix-mirror-failure into maas-cert-server:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Rod Smith
Approved revision: 7d3f52aff13ca76a45aac5814ea7bc04588fb115
Merged at revision: 5929e7e4a2b72743b336d0f292576948c717de1a
Proposed branch: ~bladernr/maas-cert-server:fix-mirror-failure
Merge into: maas-cert-server:master
Diff against target: 48 lines (+11/-5)
2 files modified
debian/changelog (+6/-0)
usr/sbin/maniacs-setup (+5/-5)
Reviewer Review Type Date Requested Status
Rod Smith Approve
Review via email: mp+354422@code.launchpad.net

Commit message

Fixed race condition where we were trying to run chown on directories and files that don't exist yet when creating a local apt mirror.
fixed bug where we were overwriting mirror.list.orig every time maniacs-setup -m was called, instead of preserving any original mirror.list file
fixed bug where we were creating a symlink called \'*\' in /var/www/html when symlinking ppa mirror directories
Fixed messaging and output.

Description of the change

Several fixes around archive mirroring.

Mostly bug fixes, but one output improvement. Now when the backgrounded mirroring operation is complete, users will get a wall message on all terminals telling them the mirror is done and it's safe to start deploying systems.

To post a comment you must log in.
Revision history for this message
Rod Smith (rodsmith) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 05eac75..0f36e12 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+maas-cert-server (0.3.5-0ppa1) bionic; urgency=medium
7+
8+ * Fixed several bugs in maniacs setup that affected archive mirroring
9+
10+ -- Jeff Lane <jeff@ubuntu.com> Thu, 06 Sep 2018 16:24:45 -0400
11+
12 maas-cert-server (0.3.4-0ppa1) bionic; urgency=medium
13
14 * The previous MR broke the APT mirror. This should fix it.
15diff --git a/usr/sbin/maniacs-setup b/usr/sbin/maniacs-setup
16index 631f551..42de2fe 100755
17--- a/usr/sbin/maniacs-setup
18+++ b/usr/sbin/maniacs-setup
19@@ -452,7 +452,7 @@ mirror_archive() {
20 fi
21 done
22 # Preserve the stock mirror.list so that we only use our custom one
23- [ -f /etc/apt/mirror.list ] && mv /etc/apt/mirror.list /etc/apt/mirror.list.orig
24+ [ -f /etc/apt/mirror.list.orig ] || ([ -f /etc/apt/mirror.list ] && mv /etc/apt/mirror.list /etc/apt/mirror.list.orig)
25 cp -a /var/spool/apt-mirror/* $ARCHIVE_MIRROR
26 write_starting_mirror_config
27 get_yn "* Should this this computer to use the local mirror" "Y"
28@@ -496,16 +496,16 @@ mirror_archive() {
29 echo "* for status information."
30 echo "*"
31 mkdir -p $MCS_DATA
32- apt-mirror &> $MCS_DATA/apt-mirror.out &
33+ (apt-mirror &> $MCS_DATA/apt-mirror.out; chown -R www-data:www-data $ARCHIVE_MIRROR/mirror/*; echo -e "Archive Mirror Action from MAAS Setup is now complete.\nYou should now be able to successfully deploy systems." |wall) &
34 echo "*"
35 echo "* Mirror operation begun."
36 echo "*"
37- echo "* After the mirror operation completes, running"
38+ echo "* You will recieve a message on this console when the mirror"
39+ echo "* operation is complete. Once complete, running"
40 echo "* $ARCHIVE_MIRROR/var/clean.sh can free up some disk space."
41 ln -sf $ARCHIVE_MIRROR/mirror/$MIRROR_HOSTNAME/ubuntu /var/www/html/ubuntu
42- ln -sf $ARCHIVE_MIRROR/mirror/ppa.launchpad.net/* /var/www/html/
43+ ln -sf `find $ARCHIVE_MIRROR/mirror/ppa.launchpad.net/ -maxdepth 1 -mindepth 1 -type d` /var/www/html/
44 [ -e $ARCHIVE_MIRROR/mirror/maas.ubuntu.com ] && ln -sf $ARCHIVE_MIRROR/mirror/maas.ubuntu.com /var/www/html/
45- chown -R www-data:www-data $ARCHIVE_MIRROR/mirror/*
46 MIRRORED=1
47 echo "*"
48 get_yn "* Set up cron to keep your mirror up-to-date (NOTE: this only works if your MAAS server has internet access)" "Y"

Subscribers

People subscribed via source and target branches