← Back to team overview

launchpad-reviewers team mailing list archive

lp:~allenap/maas/pxe-file-import-merciless-cobbler-evisceration into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/pxe-file-import-merciless-cobbler-evisceration into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/maas/pxe-file-import-merciless-cobbler-evisceration/+merge/118195

There's a lot of Cobbler specific stuff in maas-import-ephemerals and it's doing my head in. This rips it out. However, I'm not sure if we can do that yet, seeing as we might need it for 12.04.1. See bug 1032821 for why I've not been able to remove all Cobbler references from the script.
-- 
https://code.launchpad.net/~allenap/maas/pxe-file-import-merciless-cobbler-evisceration/+merge/118195
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/pxe-file-import-merciless-cobbler-evisceration into lp:maas.
=== modified file 'scripts/maas-import-ephemerals'
--- scripts/maas-import-ephemerals	2012-08-03 16:36:26 +0000
+++ scripts/maas-import-ephemerals	2012-08-03 20:32:20 +0000
@@ -19,25 +19,9 @@
 # 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/>.
 
-# Cobbler is being removed from MAAS.  Set NO_COBBLER to skip anything
-# in this script that is related to Cobbler.
-NO_COBBLER=${NO_COBBLER:-}
-
 VERBOSITY=0
 REMOTE_IMAGES_MIRROR="https://maas.ubuntu.com/images";
 
-if [ -z "$NO_COBBLER" ]
-then
-CONSOLE="ttyS0,9600n8"
-EPH_KOPTS_CONSOLE="console=$CONSOLE"
-EPH_KOPTS_ISCSI="ip=dhcp iscsi_target_name=@@iscsi_target@@ iscsi_target_ip=@@iscsi_target_ip@@ iscsi_target_port=3260"
-EPH_KOPTS_ROOT="root=LABEL=cloudimg-rootfs ro"
-EPH_KOPTS_LOGGING="log_host=@@server_ip@@ log_port=514"
-KSDIR="/var/lib/cobbler/kickstarts"
-KICKSTART="$KSDIR/maas-commissioning.preseed"
-SYS_TGT_CONF="/etc/tgt/targets.conf"
-fi
-
 # TODO: What's this for?  If set, it gets run on a downloaded disk.img,
 # kernel, and initrd.
 EPH_UPDATE_CMD=""
@@ -120,19 +104,6 @@
 }
 
 
-if [ -z "$NO_COBBLER" ]
-then
-arch2cob() {
-    # Normalize an architecture name for use in Cobbler.
-    _RET=$1
-    case "$1" in
-        i?86) _RET=i386;;
-        amd64) _RET=x86_64;;
-    esac
-}
-fi
-
-
 query_remote() {
     # query /query data at REMOTE_IMAGES_MIRROR
     # returns 7 values prefixed with 'r_'
@@ -311,60 +282,6 @@
 }
 
 
-if [ -z "$NO_COBBLER" ]
-then
-cobbler_has() {
-    local noun="$1" name="$2" out=""
-
-    out=$(cobbler "$noun" find "--name=$name" 2>/dev/null) &&
-        [ "$out" = "$name" ]
-}
-fi
-
-
-if [ -z "$NO_COBBLER" ]
-then
-cobbler_add_update() {
-    # cobbler_add_update(distro_name, profile_name,
-    #                    release, arch, kopts, kickstart,
-    #                    kernel, initrd)
-    local distro="$1" profile="$2" release="$3" arch="$4"
-    local kernel="$5" initrd="$6" kopts="$7" kickstart="$8"
-    local op
-
-    cobbler_has distro "$distro" && op="edit" || op="add"
-
-    cobbler distro "$op" "--name=$distro" --breed=ubuntu \
-        "--os-version=$release" "--arch=$arch" \
-        "--kernel=$kernel" "--initrd=$initrd" ||
-        { error "failed to $op $distro"; return 1; }
-
-    cobbler_has profile "$profile" && op="edit" || op="add"
-
-    cobbler profile "$op" "--name=$profile" "--distro=$distro" \
-        --kopts="$kopts" "--kickstart=$kickstart" ||
-        { error "failed to $op $profile"; return 1; }
-
-    return 0
-}
-fi
-
-
-if [ -z "$NO_COBBLER" ]
-then
-replace() {
-    # replace(input, key1, value1, key2, value2, ...)
-    local input="$1" key="" val=""
-    shift
-    while [ $# -ne 0 ]; do
-        input=${input//$1/$2}
-        shift 2
-    done
-    _RET=${input}
-}
-fi
-
-
 install_tftp_image() {
     # Make image in directory $1, for architecture $2 and subarchitecture $3,
     # and OS release $4, available over TFTP for netbooting nodes.  Only the
@@ -421,33 +338,6 @@
 [ ! -f ".${CONFIG}" ] || . ".${CONFIG}"
 
 
-if [ -z "$NO_COBBLER" ]
-then
-# get default server ip
-[ -n "$SERVER_IP" ] ||
-    _ip=$(awk '$1 == "server:" { print $2 }' /etc/cobbler/settings) ||
-    fail "must set SERVER_IP to cobbler server"
-
-SERVER_IP=${SERVER_IP:-${_ip}}
-[ -n "${SERVER_IP}" ] &&
-    KOPTS="$KOPTS log_host=$SERVER_IP log_port=514"
-fi
-
-
-if [ -z "$NO_COBBLER" ]
-then
-ISCSI_TARGET_IP=${ISCSI_TARGET_IP:-${SERVER_IP}}
-[ -n "$ISCSI_TARGET_IP" ] || fail "ISCSI_TARGET_IP must have a value"
-fi
-
-
-if [ -z "$NO_COBBLER" ]
-then
-[ -f "$KICKSTART" ] ||
-    fail "kickstart $KICKSTART is not a file"
-fi
-
-
 mkdir -p "$DATA_DIR" "$DATA_DIR/.working" ||
     fail "failed to make $DATA_DIR"
 
@@ -470,7 +360,6 @@
 updates=0
 for release in $RELEASES; do
     for arch in $ARCHES; do
-        arch2cob "$arch"; arch_c=$_RET
         arch2u "$arch"; arch_u=$_RET
 
         query_local "$arch_u" "$release" "$BUILD_NAME" ||
@@ -536,53 +425,18 @@
             rm "${tgt_conf_d}/${name}.conf"
             fail "failed tgt-admin add for $name"
         }
-
-
-if [ -z "$NO_COBBLER" ]
-then
-        # cobbler_update
-        kopts_in="$EPH_CONSOLE_KOPTS $EPH_KOPTS_ISCSI $EPH_KOPTS_ROOT $EPH_KOPTS_LOGGING"
-        replace "${kopts_in}" \
-            "@@server_ip@@" "$SERVER_IP" \
-            "@@iscsi_target@@" "${target_name}" \
-            "@@iscsi_target_ip@@" "${ISCSI_TARGET_IP}"
-        kopts=$_RET
-
-        distro="$release-${arch_c}-maas-ephemeral"
-        profile="maas-${release}-${arch_c}-commissioning"
-        kernel="$fpfinal_d/kernel"
-        initrd="$fpfinal_d/initrd"
-        debug 1 "updating profile $profile, distro $distro kopts:${kopts}"
-        debug 2 cobbler_add_update "$distro" "$profile" "$release" "${arch_c}" \
-            "$kernel" "$initrd" "$kopts" "$KICKSTART"
-        cobbler_add_update "$distro" "$profile" "$release" "${arch_c}" \
-            "$kernel" "$initrd" "$kopts" "$KICKSTART" || {
-                mv "${fpfinal_d}/info" "${fpfinal_d}/info.failed"
-                tgt-admin --conf "$SYS_TGT_CONF" --delete "$target_name"
-                rm "${tgt_conf_d}/${name}.conf";
-                fail "failed to update cobbler for $profile/$distro"
-            }
-fi
-
-
     done
 done
 
 
 if [ $check -eq 1 ]; then
     # if --update-check, but no updates needed, exit 3
-    [ $updates_needed -eq 0 ] && exit 3
+    [ $updates -eq 0 ] && exit 3
     # if updates are needed, exit 0
     exit 0
 fi
 
 
-if [ -z "$NO_COBBLER" ]
-then
-cobbler sync
-fi
-
-
 ## cleanup
 # here, go through anything non-current,
 #   * remove the tgt config

=== modified file 'scripts/maas-import-pxe-files'
--- scripts/maas-import-pxe-files	2012-08-03 15:12:09 +0000
+++ scripts/maas-import-pxe-files	2012-08-03 20:32:20 +0000
@@ -132,7 +132,7 @@
 import_ephemeral_images() {
     if test "$IMPORT_EPHEMERALS" != "0"
     then
-        NO_COBBLER=1 maas-import-ephemerals --import
+        maas-import-ephemerals --import
     fi
 }
 


Follow ups