Merge lp:~smoser/ubuntu/precise/cobbler/improvements.cui into lp:ubuntu/precise/cobbler

Proposed by Scott Moser
Status: Merged
Merged at revision: 71
Proposed branch: lp:~smoser/ubuntu/precise/cobbler/improvements.cui
Merge into: lp:ubuntu/precise/cobbler
Diff against target: 130 lines (+47/-12)
2 files modified
debian/changelog (+10/-0)
debian/cobbler-ubuntu-import (+37/-12)
To merge this branch: bzr merge lp:~smoser/ubuntu/precise/cobbler/improvements.cui
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+89347@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-01-18 13:50:40 +0000
3+++ debian/changelog 2012-01-19 21:45:33 +0000
4@@ -1,3 +1,13 @@
5+cobbler (2.2.2-0ubuntu16) UNRELEASED; urgency=low
6+
7+ * cobbler-ubuntu-import: fix bug where 'amd64' arch was not actually
8+ supported.
9+ * cobbler-ubuntu-import: add '--update-existing' flag for updating
10+ all existin ubuntu distros. Also fix issues where multiple
11+ codename-arch arguments were not being honored.
12+
13+ -- Scott Moser <smoser@ubuntu.com> Thu, 19 Jan 2012 16:31:18 -0500
14+
15 cobbler (2.2.2-0ubuntu15) precise; urgency=low
16
17 * debian/control: Depends on virtinst for koan. (LP: #918281)
18
19=== modified file 'debian/cobbler-ubuntu-import'
20--- debian/cobbler-ubuntu-import 2012-01-05 13:24:23 +0000
21+++ debian/cobbler-ubuntu-import 2012-01-19 21:45:33 +0000
22@@ -27,9 +27,11 @@
23 mirror. exits 0 if an update is needed or iso does
24 not exist in $ISO_DIR
25 -r | --remove remove cobbler profile/distro and cached ISO
26- -u | --update update iso, import, replace outdated distro and profile
27- -p | --proxy <host[:port> http proxy to use
28- -v | --verbose increase verbosity
29+ -u | --update update iso, import, replace outdated distro and profile
30+ -U | --update-existing
31+ update all existing ubuntu distros in cobbler
32+ -p | --proxy <host[:port> http proxy to use
33+ -v | --verbose increase verbosity
34 Note, arch can be i386, x86_64, or amd64. However,
35 the registered distro and profile will use 'x86_64' rather than 'amd64'.
36 This is to keep consistent with cobbler naming.
37@@ -138,8 +140,8 @@
38 [ "$md5sum_local" != "$md5sum_remote" ]
39 }
40
41-short_opts="Dhm:o:p:vcru"
42-long_opts="delete-iso,help,mirror:,proxy:,remove,update,update-check,remove,verbose"
43+short_opts="Dhm:o:p:vcruU"
44+long_opts="delete-iso,help,mirror:,proxy:,remove,update,update-existing,update-check,remove,verbose"
45 getopt_out=$(getopt --name "${0##*/}" \
46 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
47 eval set -- "${getopt_out}" ||
48@@ -147,6 +149,7 @@
49
50 delete=false
51 check_update=false
52+update_existing=0
53 remove=false
54 mirror=${DEFAULT_MIRROR}
55 do_update=false
56@@ -162,12 +165,22 @@
57 -c|--update-check) check_update=true;;
58 -r|--remove) remove=true;;
59 -u|--update) do_update=true;;
60+ -u|--update-existing) do_update=true; update_existing=1;;
61 --) shift; break;;
62 esac
63 shift;
64 done
65
66 ## check arguments here
67+if [ $update_existing -eq 1 ]; then
68+ [ $# -eq 0 ] ||
69+ bad_Usage "do not provide arguments with update-existing"
70+ _existing=$(cobbler distro find --breed=ubuntu) ||
71+ fail "failed to get list of existing distros"
72+ [ -n "$_existing" ] ||
73+ fail "there were no existing distros of type ubuntu"
74+ set -- $_existing
75+fi
76 [ $# -ne 0 ] || bad_Usage "must provide arguments"
77
78 TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
79@@ -185,10 +198,12 @@
80 fi
81 mkdir "$TEMP_D/mnt" || fail "failed to make tempdir/mnt"
82
83+updates_needed=0
84+
85 for tok in "$@"; do
86 REL=${tok%-*}; ARCH=${tok#*-}
87 [ "$ARCH" = "amd64" ] &&
88- { error "Warning: using x86_64 for arch rather than amd64"; arch="x86_64"; }
89+ { error "Warning: using x86_64 for arch rather than amd64"; ARCH="x86_64"; }
90 ubuntu_arch=$ARCH; [ "$ARCH" = "x86_64" ] && ubuntu_arch=amd64
91 ISO=$REL-$ARCH-mini.iso
92 U=$mirror/dists/$REL/main/installer-$ubuntu_arch/current/images/netboot/mini.iso
93@@ -206,21 +221,31 @@
94 cobbler distro remove --name="$REL-$ARCH" ||
95 fail "Could not remove cobbler profile for $REL-$ARCH"
96 fi
97- exit 0
98+ continue
99 fi
100 if $check_update; then
101- update_available && echo "Update for $REL-$ARCH available" && exit 0
102- echo "$ISO_DIR/$ISO up to date." && exit 3
103+ if update_available; then
104+ echo "$REL-$ARCH: Update available"
105+ updates_needed=$(($updates_needed+1));
106+ else
107+ echo "$REL-$ARCH: Up to date"
108+ fi
109+ continue
110 fi
111 if $do_update; then
112- update_available || fail "No update available"
113+ update_available ||
114+ { echo "$REL-$ARCH: no update available"; continue; }
115 # get iso from either pocket and import it with a tmp name.
116 get_iso && import_iso "tmp-$REL-$ARCH"
117 reassign_distro "tmp-$REL-$ARCH" "$REL-$ARCH"
118- exit 0
119+ continue
120 fi
121 [[ ! -f "$ISO_DIR/$ISO" ]] && get_iso
122- import_iso "$REL-$ARCH" && echo "imported $REL-$ARCH"
123+ import_iso "$REL-$ARCH" && echo "$REL-$ARCH: imported"
124 done
125
126+if $check_update; then
127+ [ $updates_needed -eq 0 ] && exit 3
128+fi
129+
130 # vi: ts=4 noexpandtab

Subscribers

People subscribed via source and target branches

to all changes: