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
diff --git a/debian/changelog b/debian/changelog
index 05eac75..0f36e12 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1maas-cert-server (0.3.5-0ppa1) bionic; urgency=medium
2
3 * Fixed several bugs in maniacs setup that affected archive mirroring
4
5 -- Jeff Lane <jeff@ubuntu.com> Thu, 06 Sep 2018 16:24:45 -0400
6
1maas-cert-server (0.3.4-0ppa1) bionic; urgency=medium7maas-cert-server (0.3.4-0ppa1) bionic; urgency=medium
28
3 * The previous MR broke the APT mirror. This should fix it.9 * The previous MR broke the APT mirror. This should fix it.
diff --git a/usr/sbin/maniacs-setup b/usr/sbin/maniacs-setup
index 631f551..42de2fe 100755
--- a/usr/sbin/maniacs-setup
+++ b/usr/sbin/maniacs-setup
@@ -452,7 +452,7 @@ mirror_archive() {
452 fi452 fi
453 done453 done
454 # Preserve the stock mirror.list so that we only use our custom one454 # Preserve the stock mirror.list so that we only use our custom one
455 [ -f /etc/apt/mirror.list ] && mv /etc/apt/mirror.list /etc/apt/mirror.list.orig455 [ -f /etc/apt/mirror.list.orig ] || ([ -f /etc/apt/mirror.list ] && mv /etc/apt/mirror.list /etc/apt/mirror.list.orig)
456 cp -a /var/spool/apt-mirror/* $ARCHIVE_MIRROR456 cp -a /var/spool/apt-mirror/* $ARCHIVE_MIRROR
457 write_starting_mirror_config457 write_starting_mirror_config
458 get_yn "* Should this this computer to use the local mirror" "Y"458 get_yn "* Should this this computer to use the local mirror" "Y"
@@ -496,16 +496,16 @@ mirror_archive() {
496 echo "* for status information."496 echo "* for status information."
497 echo "*"497 echo "*"
498 mkdir -p $MCS_DATA498 mkdir -p $MCS_DATA
499 apt-mirror &> $MCS_DATA/apt-mirror.out &499 (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) &
500 echo "*"500 echo "*"
501 echo "* Mirror operation begun."501 echo "* Mirror operation begun."
502 echo "*"502 echo "*"
503 echo "* After the mirror operation completes, running"503 echo "* You will recieve a message on this console when the mirror"
504 echo "* operation is complete. Once complete, running"
504 echo "* $ARCHIVE_MIRROR/var/clean.sh can free up some disk space."505 echo "* $ARCHIVE_MIRROR/var/clean.sh can free up some disk space."
505 ln -sf $ARCHIVE_MIRROR/mirror/$MIRROR_HOSTNAME/ubuntu /var/www/html/ubuntu506 ln -sf $ARCHIVE_MIRROR/mirror/$MIRROR_HOSTNAME/ubuntu /var/www/html/ubuntu
506 ln -sf $ARCHIVE_MIRROR/mirror/ppa.launchpad.net/* /var/www/html/507 ln -sf `find $ARCHIVE_MIRROR/mirror/ppa.launchpad.net/ -maxdepth 1 -mindepth 1 -type d` /var/www/html/
507 [ -e $ARCHIVE_MIRROR/mirror/maas.ubuntu.com ] && ln -sf $ARCHIVE_MIRROR/mirror/maas.ubuntu.com /var/www/html/508 [ -e $ARCHIVE_MIRROR/mirror/maas.ubuntu.com ] && ln -sf $ARCHIVE_MIRROR/mirror/maas.ubuntu.com /var/www/html/
508 chown -R www-data:www-data $ARCHIVE_MIRROR/mirror/*
509 MIRRORED=1509 MIRRORED=1
510 echo "*"510 echo "*"
511 get_yn "* Set up cron to keep your mirror up-to-date (NOTE: this only works if your MAAS server has internet access)" "Y"511 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