Merge lp:~allenap/maas/packaging.cluster-pserv-address-bug-1081212-part-2-the-revenge into lp:~maas-maintainers/maas/packaging

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 153
Merged at revision: 153
Proposed branch: lp:~allenap/maas/packaging.cluster-pserv-address-bug-1081212-part-2-the-revenge
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 27 lines (+4/-2)
2 files modified
debian/changelog (+2/-0)
debian/maas-cluster-controller.postinst (+2/-2)
To merge this branch: bzr merge lp:~allenap/maas/packaging.cluster-pserv-address-bug-1081212-part-2-the-revenge
Reviewer Review Type Date Requested Status
Julian Edwards (community) Needs Fixing
Raphaël Badin (community) Approve
Review via email: mp+136414@code.launchpad.net

Commit message

Remove leading comment markers from the 'generator' line in pserv.yaml during cluster postinst.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good. I've tested the sed command on a real-world config file for confirmation.

This will need to be backported to quantal and precise.

review: Approve
153. By Gavin Panella

Merge trunk.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

This will break/not work if someone has done this:

## TFTP configuration.
#
tftp:
  # root: /var/lib/maas/tftp
  # port: 69
  ## The URL to be contacted to generate PXE configurations.
  # generator: http://localhost/MAAS/api/1.0/pxeconfig/
generator: http://somewhere/MAAS/api/1.0/pxeconfig/

I suggest first looking for a line without the comment, and if there isn't one, add it, before doing what the postinst originally did.

review: Needs Fixing
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Also this fails to update a line like this:

# generator: http://foo:5243/api/1.0/pxeconfig/

Revision history for this message
Julian Edwards (julian-edwards) wrote :

I'm going to backport this to 1.2 on the understanding that it fixes the "as shipped" case right now. If someone is editing config manually I guess they may break it.

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-11-27 11:53:02 +0000
3+++ debian/changelog 2012-11-27 14:15:36 +0000
4@@ -37,6 +37,8 @@
5 configuration file are no longer part of upstream.
6 * debian/maas-cluster-controller.install: The maas-import-pxe-files cron
7 task is no longer used.
8+ * debian/maas-cluster-controller.postinst: Remove leading comment
9+ markers from the 'generator' line in pserv.yaml.
10
11 [ Andres Rodriguez ]
12 * debian/control:
13
14=== modified file 'debian/maas-cluster-controller.postinst'
15--- debian/maas-cluster-controller.postinst 2012-11-27 11:53:02 +0000
16+++ debian/maas-cluster-controller.postinst 2012-11-27 14:15:36 +0000
17@@ -57,9 +57,9 @@
18 sed -i "s|MAAS_URL=.*|MAAS_URL="$RET"|" /etc/maas/maas_cluster.conf
19 # Extract the hostname part.
20 HOSTPART=$(echo $RET|awk '{ split($0,array,"/")} END{print array[3] }')
21- # And substitute it in-place in pserv.conf on an indented, non-commented
22+ # And substitute it in-place in pserv.yaml on an indented, non-commented
23 # line.
24- sed -ri "s|^([[:space:]]+generator:[[:space:]]+https?://)[^:/]+|\1$HOSTPART|" /etc/maas/pserv.yaml
25+ sed -ri "s|^([[:space:]]+)(#+[[:space:]]*)?(generator:[[:space:]]+https?://)[^:/]+|\1\3$HOSTPART|" /etc/maas/pserv.yaml
26 fi
27 fi
28

Subscribers

People subscribed via source and target branches