launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #10919
[Merge] lp:~jtv/maas/kill-maas-import-isos into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/kill-maas-import-isos into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/kill-maas-import-isos/+merge/119511
Actually this does several things:
* Removes maas-import-isos and its man page.
* Deletes Cobbler code that refers to maas-import-isos.
* Rewrites user-interface text that refers to maas-import-isos.
* Renames the import_isos config file to import_pxe_files.
The deletions may seem half-hearted. They may be enough to break a Cobbler-based MAAS, but I didn't go all the way to remove more Cobbler code. I wanted same chance to keep seeing what I was doing. And I particularly wanted to get to a “grep” producing zero output, so that I could be really sure that I hadn't missed a spot!
The renaming of the config file does maintain a compatibility provision, so systems that maintain a customized /etc/maas/import_isos won't break completely.
Jeroen
--
https://code.launchpad.net/~jtv/maas/kill-maas-import-isos/+merge/119511
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/kill-maas-import-isos into lp:maas.
=== removed file 'etc/cron.d/maas-import-isos'
--- etc/cron.d/maas-import-isos 2012-08-03 16:33:05 +0000
+++ etc/cron.d/maas-import-isos 1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
-# Runs maas-import-isos every Sunday at 4am
-# This will get the new mini.iso and generate a new cobbler profile
-11 4 * * 0 root /usr/sbin/maas-import-isos &> /dev/null
=== modified file 'etc/maas/import_ephemerals'
--- etc/maas/import_ephemerals 2012-08-03 16:36:26 +0000
+++ etc/maas/import_ephemerals 2012-08-14 11:10:28 +0000
@@ -1,5 +1,5 @@
-## get default settings from maas_import_iso
-[ ! -f /etc/maas/maas_import_iso ] || . /etc/maas/maas_import_iso
+## get default settings from import_pxe_files
+[ ! -f /etc/maas/import_pxe_files ] || . /etc/maas/import_pxe_files
#REMOTE_IMAGES_MIRROR="https://cloud-images.ubuntu.com"
#ISCSI_TARGET_IP="" # defaults to cobbler server setting
=== renamed file 'etc/maas/import_isos' => 'etc/maas/import_pxe_files'
--- etc/maas/import_isos 2012-04-11 02:18:12 +0000
+++ etc/maas/import_pxe_files 2012-08-14 11:10:28 +0000
@@ -1,3 +1,17 @@
+# This file replaces an older one called import_isos. Include that here for
+# compatibility.
+if [ -f /etc/maas/import_isos ]
+then
+ cat <<EOF
+
+Including obsolete /etc/maas/import_isos in configuration. This file has been
+superseded by import_pxe_files. Please see if it can be removed.
+
+EOF
+ . /etc/maas/import_isos
+fi
+
+
#RELEASES="oneiric precise"
RELEASES="precise"
#ARCHES="amd64 i386"
=== removed file 'man/maas-import-isos.8'
--- man/maas-import-isos.8 2012-03-08 16:12:27 +0000
+++ man/maas-import-isos.8 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-.TH maas\-import\-isos 8 "25 May 2011" maas "maas"
-.SH NAME
-\fBmaas\-import\-isos\fP \- sync and import Ubuntu isos into cobbler
-
-.SH DESCRIPTION
-\fBmaas\-import\-isos\fP is a utility useful to automatically download
-and import Ubuntu ISOs into \fBcobbler\fP(1).
-
-It reads a configuration file \fI/etc/maas/import_isos\fP in order to
-determine:
- - ARCHIVE
- - RELEASES
- - ARCHES
- - CACHE
- - KSMIRROR
- - KSDIR
- - LOCALE
- - PRIORITY
-
-For each release in RELEASES, and each arch in ARCHES, it will use
-\fBwget\fP(1) to download the Ubuntu mini.iso for each. The mini.iso
-is used because it is a small download, and the rest of the
-installation is performed over the network and packages are cached
-using \fBsquid\fP(8).
-
-A loop \fBmount\fP(8) is performed, and "\fBcobbler\fP(1) import" is
-then executed with the appropriate parameters, in order to update
-cobbler's knowledge of its available distributions and releases.
-
-A \fBcron\fP(8) job typically runs this import-and-sync at 4am on
-Sundays.
-
-.SH FILES
-\fI/etc/maas/import_isos\fP, \fI/etc/cron.d/maas-import-isos\fP
-
-.SH "SEE ALSO"
-.PD 0
-.TP
-\fBmount\fP(8), \fBcobbler\fP(1), \fBwget\fP(1), \fBsquid\fP(8)
-
-.TP
-\fIhttp://launchpad.net/maas\fP
-.PD
-
-.SH AUTHOR
-This manpage and the utility were written by Dustin Kirkland
-<kirkland@xxxxxxxxxxxxx> for Ubuntu systems (but may be used by
-others). Permission is granted to copy, distribute and/or modify this
-document and the utility under the terms of the GNU General Public
-License, Version 3 published by the Free Software Foundation.
-
-The complete text of the GNU General Public License can be found in
-\fI/usr/share/common-licenses/GPL\fP on Debian/Ubuntu systems, or on
-the web at \fIhttp://www.gnu.org/licenses/gpl.txt\fP.
=== modified file 'man/maas-import-pxe-files.8'
--- man/maas-import-pxe-files.8 2012-08-03 16:36:26 +0000
+++ man/maas-import-pxe-files.8 2012-08-14 11:10:28 +0000
@@ -8,15 +8,16 @@
systems. Images that are already in place are kept unchanged, unless the
version in the archive has since been updated.
-The script reads a configuration file \fI/etc/maas/import_isos\fP in order
-to determine:
+The script reads a configuration file \fI/etc/maas/import_pxe_files\fP in
+order to determine:
- ARCHIVE: Location of the Ubuntu download archive
- RELEASES: Ubuntu releases to download
- CURRENT_RELEASE: Most up-to-date Ubuntu release
- ARCHES: Architectures for which images should be downloaded
(To support development setups that run directly from a code branch, it will
-also look for \fIetc/maas/import_isos\fP relative to the current directory).
+also look for \fIetc/maas/import_pxe_files\fP relative to the current
+directory).
The script uses \fBwget\fP(1) to download the kernel and initrd image for
each architecture in ARCHES and each release in RELEASES. It will also
@@ -30,11 +31,10 @@
but you may need to run it manually once for a new MAAS installation.
.SH FILES
-\fI/etc/maas/import_isos\fP, \fI/etc/cron.d/maas\-import\-pxe\-files\fP
+\fI/etc/maas/import_pxe_files\fP, \fI/etc/cron.d/maas\-import\-pxe\-files\fP
.SH "SEE ALSO"
.BR maas\-import\-ephemerals (8),
-.BR maas\-import\-isos (8),
.BR cron (8),
.BR wget (1)
=== modified file 'scripts/maas-import-ephemerals'
--- scripts/maas-import-ephemerals 2012-08-10 03:22:50 +0000
+++ scripts/maas-import-ephemerals 2012-08-14 11:10:28 +0000
@@ -83,8 +83,8 @@
cat <<EOF
Usage: ${0##*/} [ options ] <<ARGUMENTS>>
- Import ephemeral (commissioning) images into maas
- Settings are read from /etc/maas/maas_import_ephemerals
+ Import ephemeral (commissioning) images into maas.
+ Settings are read from $CONFIG.
options:
-i | --import initial import or freshen the images
=== removed file 'scripts/maas-import-isos'
--- scripts/maas-import-isos 2012-08-10 03:48:47 +0000
+++ scripts/maas-import-isos 1970-01-01 00:00:00 +0000
@@ -1,205 +0,0 @@
-#!/bin/sh
-#
-# maas-import-isos - sync and import Ubuntu isos into cobbler
-#
-# Copyright (C) 2011-2012 Canonical
-#
-# Authors:
-# Marc Cluet <marc.cluet@xxxxxxxxxxxxx>
-# Dustin Kirkland <kirkland@xxxxxxxxxxxxx>
-# Andres Rodriguez <andres.rodriguez@xxxxxxxxxxxxx>
-# Scott Moser <scott.moser@xxxxxxxxxxxxx>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, version 3 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Ensure root
-if [ "$(id -u)" != "0" ]; then
- echo "ERROR: $0 must run as root" 2>&1
- exit 1
-fi
-
-# Definitions for supported releases and architectures
-[ -r $(pwd)/etc/maas/import_isos ] && . $(pwd)/etc/maas/import_isos
-[ -r /etc/maas/import_isos ] && . /etc/maas/import_isos
-[ -n "$RELEASES" ] || RELEASES=$(distro-info --supported)
-[ -n "$ARCHES" ] || ARCHES="amd64 i386"
-[ -n "$KSDIR" ] || KSDIR="/var/lib/cobbler/kickstarts"
-[ -n "$PRIORITY" ] || PRIORITY="critical"
-[ -n "$LOCALE" ] || LOCALE="en_US"
-[ -n "$INTERFACE" ] || INTERFACE="auto"
-[ -n "$KOPTS" ] || KOPTS="priority=$PRIORITY locale=$LOCALE netcfg/choose_interface=$INTERFACE"
-[ -n "$ENLIST_PROFILE" ] || ENLIST_PROFILE="maas-enlist"
-[ -n "$IMPORT_EPHEMERALS" ] || IMPORT_EPHEMERALS=1
-if [ -n "$SERVER_IP" ]; then
- KOPTS="$KOPTS log_host=$SERVER_IP log_port=514"
-else
- if grep -qs "^server: " /etc/cobbler/settings >/dev/null 2>&1; then
- SERVER_IP=$(grep "^server: " /etc/cobbler/settings | awk '{print $2}')
- KOPTS="$KOPTS log_host=$SERVER_IP log_port=514"
- fi
-fi
-if [ -n "$CONSOLE" ]; then
- KOPTS="$KOPTS console=$CONSOLE"
-fi
-
-
-name_arch_in_cobbler_style() {
- echo "$1" | sed -e 's/amd64/x86_64/' -e 's/i686/i386/'
-}
-
-
-update_settings(){
- local r a profile
- # Updates the parent profiles with new settings. Only affects KOPTS
- for r in $RELEASES; do
- for a in $ARCHES; do
- a=$(name_arch_in_cobbler_style "$a")
- profile="maas-$r-$a"
- # If profile exists, update it.
- if (cobbler profile list | grep -qs " $profile$"); then
- cobbler profile edit --name="$profile" --kopts="$KOPTS"
- fi
- done
- done
-
- [ "$IMPORT_EPHEMERALS" = "0" ] || maas-import-ephemerals --update
-}
-
-import_isos(){
- local r a profile
- # Wget and import net install ISOs
- for r in $RELEASES; do
- for a in $ARCHES; do
- a=$(name_arch_in_cobbler_style "$a")
- profile="$r-$a"
- # Skip if cobbler already has this distro/arch combo
- if ! (cobbler distro list | grep -qs " $profile$"); then
- # Import the iso
- cobbler-ubuntu-import $profile
- else
- # check archive for an updated ISO, update our cache if necessary
- cobbler-ubuntu-import -c $profile && cobbler-ubuntu-import -u $profile
-
- fi
- # Skip if cobbler already has this distro/arch profile
- if ! (cobbler profile list | grep -qs " maas-$profile$"); then
- # Add JuJu sub-profile based on the name of the imported ISO
- cobbler profile add --name="maas-$profile" --parent="$profile" --kopts="$KOPTS" --kickstart="$KSDIR/maas.preseed"
- fi
- done
- done
-
- [ "${IMPORT_EPHEMERALS}" = "0" ] || maas-import-ephemerals --import
-}
-
-add_enlist_profile(){
- STABLE=$(distro-info --stable)
- DEVEL=$(distro-info --devel)
- PARENT_PROFILE=""
-
- # Check what release to use as parent profile
- if [ `echo $STABLE "precise" | awk '{ print ($1 >= $2) ? "True" : "False" }'` = True ]; then
- PARENT_PROFILE="maas-$STABLE-i386-commissioning"
- else
- PARENT_PROFILE="maas-$DEVEL-i386-commissioning"
- fi
-
- # Add enlist profile
- if cobbler profile list | grep -qs " $ENLIST_PROFILE"; then
- cobbler profile edit --name="$ENLIST_PROFILE" --parent="$PARENT_PROFILE" --kopts="$KOPTS" --kickstart="$KSDIR/maas-enlist.preseed"
- else
- cobbler profile add --name="$ENLIST_PROFILE" --parent="$PARENT_PROFILE" --kopts="$KOPTS" --kickstart="$KSDIR/maas-enlist.preseed"
- fi
-
- # Add 'default' system if doesn't exist.
- (cobbler system list | grep -qs " default") || cobbler system add --name="default" --profile="$ENLIST_PROFILE"
-}
-
-Usage() {
- cat <<EOF
-Usage: ${0##*/} [ options ]
-
- import Ubuntu releases and update default MAAS settings
-
- options:
- -i | --import-isos Import the Ubuntu ISOs and update default
- settings used for MAAS. (default)
- -u | --update-settings Updates all profiles based on new settings
- in /etc/maas/import_isos.
-
- The --import process downloads and imports a list of Ubuntu releases,
- adding the default MAAS settings for each of the profiles. If a
- release has already been imported but is out of date, the updated ISO
- will be downloaded again and reimported.
-
- If the ISOs have already been imported, update-settings will update all
- the profiles within cobbler based on the modifications of
- /etc/maas/import_isos.
-
- Example:
- - ${0##*/} -i
-EOF
-}
-
-bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; exit 1; }
-
-short_opts="hiu"
-long_opts="import-isos,update-settings"
-getopt_out=$(getopt --name "${0##*/}" \
- --options "${short_opts}" --long "${long_opts}" -- "$@") &&
- eval set -- "${getopt_out}" ||
- bad_Usage
-
-do_import_isos=false
-do_update_settings=false
-
-while [ $# -ne 0 ]; do
- cur=${1};
- case "$cur" in
- -h|--help) Usage ; exit 0;;
- -i|--import-isos) do_import_isos=true;;
- -u|--update-settings) do_update_settings=true;;
- --) shift; break;;
- esac
- shift;
-done
-
-## check arguments here
-[ $# -ne 0 ] && bad_Usage
-
-# Older versions of maas-import-isos may have created PXE images in the
-# TFTP directory tree that are not world-readable as they should be.
-# This script doesn't know where they are, but if they are in the
-# default location, it can ease the pain by fixing up their access mode
-# now.
-if [ -d /var/lib/tftpboot/maas ]
-then
- chmod -R a+r /var/lib/tftpboot/maas
-fi
-
-# if no action specified, import by default
-( ! $do_import_isos && ! $do_update_settings ) && do_import_isos=true
-# do not allow import + update
-( $do_import_isos && $do_update_settings ) && bad_Usage
-
-$do_import_isos && import_isos
-$do_update_settings && update_settings
-
-# Add enlist profile if doesn't exist
-add_enlist_profile
-
-# Sync changes with cobbler daemon
-cobbler sync
-
-# Clear MAAS' cache to force the profile check.
-maas clearcache --key=profile-check-done
=== modified file 'scripts/maas-import-pxe-files'
--- scripts/maas-import-pxe-files 2012-08-14 01:30:00 +0000
+++ scripts/maas-import-pxe-files 2012-08-14 11:10:28 +0000
@@ -15,7 +15,7 @@
set -o nounset
# Load settings if available.
-settings="/etc/maas/import_isos"
+settings="/etc/maas/import_pxe_files"
[ -r $settings ] && . $settings
local_settings="$(pwd)/$settings"
[ -r $local_settings ] && . $local_settings
=== modified file 'src/maasserver/components.py'
--- src/maasserver/components.py 2012-04-16 10:00:51 +0000
+++ src/maasserver/components.py 2012-08-14 11:10:28 +0000
@@ -22,7 +22,7 @@
class COMPONENT:
COBBLER = 'cobbler server'
PSERV = 'provisioning server'
- IMPORT_ISOS = 'maas-import-isos script'
+ IMPORT_PXE_FILES = 'maas-import-pxe-files script'
# Persistent errors are global to a MAAS instance.
=== modified file 'src/maasserver/provisioning.py'
--- src/maasserver/provisioning.py 2012-08-06 12:15:06 +0000
+++ src/maasserver/provisioning.py 2012-08-14 11:10:28 +0000
@@ -13,7 +13,6 @@
__all__ = [
'check_profiles',
'get_provisioning_api_proxy',
- 'get_all_profile_names',
'present_detailed_user_friendly_fault',
'ProvisioningProxy',
]
@@ -74,9 +73,8 @@
PSERV_FAULT.NO_SUCH_PROFILE: """
System profile does not exist: %(fault_string)s.
- Has the maas-import-isos script been run? This will run
- automatically from time to time, but if it is failing, an
- administrator may need to run it manually.
+ This is a Cobbler error and should no longer occur now that Cobbler
+ has been removed as a component of MAAS.
""",
PSERV_FAULT.GENERIC_COBBLER_ERROR: """
The provisioning service encountered a problem with the Cobbler
@@ -185,7 +183,11 @@
# uses. This way, when calling the method is a success, if means that
# the related components are working properly.
METHOD_COMPONENTS = {
- 'add_node': [COMPONENT.PSERV, COMPONENT.COBBLER, COMPONENT.IMPORT_ISOS],
+ 'add_node': [
+ COMPONENT.PSERV,
+ COMPONENT.COBBLER,
+ COMPONENT.IMPORT_PXE_FILES,
+ ],
'modify_nodes': [COMPONENT.PSERV, COMPONENT.COBBLER],
'delete_nodes_by_name': [COMPONENT.PSERV, COMPONENT.COBBLER],
'get_profiles_by_name': [COMPONENT.PSERV, COMPONENT.COBBLER],
@@ -199,7 +201,7 @@
PSERV_FAULT.NO_COBBLER: COMPONENT.COBBLER,
PSERV_FAULT.COBBLER_AUTH_FAILED: COMPONENT.COBBLER,
PSERV_FAULT.COBBLER_AUTH_ERROR: COMPONENT.COBBLER,
- PSERV_FAULT.NO_SUCH_PROFILE: COMPONENT.IMPORT_ISOS,
+ PSERV_FAULT.NO_SUCH_PROFILE: COMPONENT.IMPORT_PXE_FILES,
PSERV_FAULT.GENERIC_COBBLER_ERROR: COMPONENT.COBBLER,
PSERV_FAULT.COBBLER_DNS_LOOKUP_ERROR: COMPONENT.COBBLER,
8002: COMPONENT.PSERV,
@@ -415,8 +417,9 @@
def check_profiles():
"""Check that Cobbler has profiles defined for all the profiles used by
- MAAS. If a profile is missing, display a persistent error with an invite
- to run the maas-import-isos script.
+ MAAS.
+
+ This should no longer be relevant, since Cobbler is being removed.
"""
all_profiles = get_all_profile_names()
papi = get_provisioning_api_proxy()
@@ -426,13 +429,13 @@
# Some profiles are missing: display a persistent component
# error.
register_persistent_error(
- COMPONENT.IMPORT_ISOS,
+ COMPONENT.IMPORT_PXE_FILES,
mark_safe(
"""
- Some of the required system profiles are missing.
- Run the maas-import-isos script to import Ubuntu isos and
- create the related profiles:
- <pre>sudo maas-import-isos</pre>
+ Some Cobbler system profiles are missing.
+
+ Cobbler has been removed as a component of MAAS; this should
+ no longer matter.
"""))
=== modified file 'src/maasserver/tests/test_provisioning.py'
--- src/maasserver/tests/test_provisioning.py 2012-08-06 12:15:06 +0000
+++ src/maasserver/tests/test_provisioning.py 2012-08-14 11:10:28 +0000
@@ -164,7 +164,7 @@
"invalid profile name: %s" % profile))
friendly_text = friendly_fault.message
self.assertIn(profile, friendly_text)
- self.assertIn("maas-import-isos", friendly_text)
+ self.assertIn("profile", friendly_text)
def test_present_detailed_fault_describes_generic_cobbler_fail(self):
error_text = factory.getRandomString()
@@ -316,19 +316,6 @@
get_profile_name(arch, commissioning))
self.assertItemsEqual(expected_profiles, get_all_profile_names())
- def test_provision_post_save_Node_checks_for_missing_profile(self):
- # If the required profile for a node is missing, MAAS reports
- # that the maas-import-isos script may need running.
-
- def raise_missing_profile(*args, **kwargs):
- raise Fault(PSERV_FAULT.NO_SUCH_PROFILE, "Unknown profile.")
-
- self.patch(self.papi.proxy, 'add_node', raise_missing_profile)
- with ExpectedException(ExternalComponentException):
- node = factory.make_node()
- provisioning.provision_post_save_Node(
- sender=Node, instance=node, created=True)
-
def test_provision_post_save_Node_returns_other_pserv_faults(self):
def raise_fault(*args, **kwargs):
@@ -472,21 +459,12 @@
check_profiles()
self.assertEqual([], get_persistent_errors())
- def test_check_profiles_error_registered_if_not_all_profiles_found(self):
- def return_some_profiles(profiles):
- return profiles[1:]
- self.patch_get_profiles_by_name(return_some_profiles)
-
- check_profiles()
- errors = get_persistent_errors()
- self.assertIn("<pre>sudo maas-import-isos</pre>", errors[0])
-
def test_failing_components_cleared_if_add_node_works(self):
self.patch(components, '_PERSISTENT_ERRORS', {})
register_persistent_error(COMPONENT.PSERV, factory.getRandomString())
register_persistent_error(COMPONENT.COBBLER, factory.getRandomString())
register_persistent_error(
- COMPONENT.IMPORT_ISOS, factory.getRandomString())
+ COMPONENT.IMPORT_PXE_FILES, factory.getRandomString())
self.papi.add_node('node', 'hostname', 'profile', 'power', '')
self.assertEqual([], get_persistent_errors())
=== modified file 'vdenv/zimmer-build/ud-build.txt'
--- vdenv/zimmer-build/ud-build.txt 2012-08-03 16:33:05 +0000
+++ vdenv/zimmer-build/ud-build.txt 2012-08-14 11:10:28 +0000
@@ -74,23 +74,6 @@
# care of restarting things that need to be
/usr/local/bin/maas-set-ip set auto
- # now basically wait around until cobbler is available
- # detach to not block the rest of boot
- sh -c '
- max=3; i=0;
- while [ $i -lt $max ]; do
- # will exit 155 if "cobblerd does not appear to be running"
- cobbler system list >/dev/null
- [ $? -eq 155 ] || break
- sleep 4
- i=$(($i+1))
- done
-
- if [ $i -ne $max ]; then
- # if we talked to cobbler above, then sync it and import-isos
- cobbler sync
- maas-import-isos --update
- fi' &
END_MAAS_IP_FIXUP
chmod 755 /etc/rc.local.d/maas-ip-fixup
@@ -156,13 +139,13 @@
chmod 755 /usr/local/bin/maas-set-ip
my_release=$(lsb_release -c)
- cat >> /etc/maas/import_isos <<END
+ cat >> /etc/maas/import_pxe_files <<END
RELEASES="${my_release}"
ARCHES="i386 amd64"
END
echo === $(date): starting import ====
- maas-import-isos
+ maas-import-pxe-files
sed -i '/zimmer-server/d' /etc/hosts