~ubuntu-branches/ubuntu/raring/maas/raring

« back to all changes in this revision

Viewing changes to debian/maas-cluster-controller.postinst

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Raphaël Badin, Julian Edwards, Andres Rodriguez, Gavin Panella, Jeroen Vermeulen
  • Date: 2012-11-13 14:58:21 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20121113145821-6jq53jtljo3qou80
Tags: 1.2+bzr1349+dfsg-0ubuntu1
* New upstream bugfix release. Fixes:
  - The DNS configuration is not created if maas-dns is installed after
    the DNS config has been set up (LP: #1085865).
  - IPMI detection ends up with power_address of 0.0.0.0 (LP: #1064224)
  - Main page slow to load with many nodes (LP: #1066775)
  - maas-cluster-controller doesn't have images for
    provisioning (LP: #1068843)
  - Filestorage is unique to each appserver instance (LP: #1069734)
  - import_pxe_files does not include quantal (LP: #1069850)
  - maas-cli nodes new incomplete documentation (LP: #1070522)
  - DNS forward zone ends up with nonsensical entries (LP: #1070765)
  - The hostname of a node can still be changed once the node is in
    use. (LP: #1070774)
  - The zone name (attached to a cluster controller) can still be changed
    when it contains in-use nodes and DNS is managed. (LP: #1070775)
  - Duplicated prefix in the url used by the CLI (LP: #1075597)
  - Not importing Quantal boot images (LP: #1077180)
  - Nodes are deployed with wrong domain name. (LP: #1078744)
  - src/maasserver/api.py calls request.data.getlist with a 'default'
    parameter. That parameter is not supported by Django 1.3. (LP: #1080673)
  - API calls that return a node leak private data (LP: #1034318)
  - MAAS hostnames should be 5 easily disambiguated characters (LP: #1058998)
  - URI in API description wrong when accessing machine via alternative
    interface. (LP: #1059645)
  - Oops when renaming nodegroup w/o interface (LP: #1077075)
  - Error in log when using 'Start node' button: MAASAPINotFound: No user
    data available for this node. (LP: #1069603)

[ Raphaël Badin ]
* debian/maas-dns.postinst: Call write_dns_config (LP: #1085865).
* debian/maas-dns.postinst: fix permissions and group ownership of
  file /etc/bind/maas/named.conf.rndc.maas. (LP: #1066935)

[ Julian Edwards ]
* debian/maas-region-controller.install: Remove installation of maas-gc; it
  is no longer required as upstream no longer stores files in the filesystem.
  (LP: #1069734)
* debian/maas-cluster-controller.postinst: Ensure that /etc/maas/pserv.yaml
  is updated when reconfiguring. (LP: #1081212)

[ Andres Rodriguez ]
* debian/control:
  - maas-cluster-controller Conflicts with tftpd-hpa (LP: #1076028)
  - maas-dns: Conflicts with dnsmasq
  - Drop Dependency on rabbitmq-server for maas-cluster-controller.
    (LP: #1072744)
  - Add conflicts/replaces for maas-region-controller to
    maas-cluster-controller.
* debian/maas-cluster-controller.config: If URL has been detected, add
  /MAAS if it doesn't contain it. This helps upgrades from versions where
  DEFAULT_MAAS_URL didn't use /MAAS.
* Install maas-import-pxe-files and related files with
  maas-cluster-controller, as well as configure tgtd, as
  maas-region-controller no longer stores images. Thanks to Jeroen
  Vermuelen.

[ Gavin Panella ]
* debian/extras/99-maas: squashfs image download is no longer needed.
* debian/maas-cluster-controller.install: maas-import-squashfs and its
  configuration file are no longer part of upstream.

[ Jeroen Vermeulen ]
* debian/maas-cluster-controller.maas-pserv.upstart: Source maas_cluster.conf
  before starting pserv (tftpd) process.
* debian/maas-cluster-controller.postinst: Duplicate CLUSTER_UUID setting
  to maas_cluster.conf.
* Bumped revision number to current 1.2 revision 1342 (requested by rvba).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    chmod -R 775 /var/log/maas/oops
18
18
}
19
19
 
 
20
configure_maas_tgt(){
 
21
        # Set up iSCSI: add maas.conf to tgt conf.d.
 
22
        local tgtcfg="/etc/tgt/targets.conf"
 
23
        [ -d /etc/tgt/conf.d/ ] || 
 
24
           echo "Warning! $tgtcfg did not exist" 1>&2;
 
25
        mkdir -p /etc/tgt/conf.d/ /var/lib/maas/ephemeral/
 
26
        ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
 
27
}
 
28
 
 
29
extract_cluster_uuid(){
 
30
    # Extract ClUSTER_UUID setting from config file $1.  This will work
 
31
    # both the cluster celery config (which is python) and the cluster
 
32
    # config (which is shell).
 
33
    sed -n -e "s/^CLUSTER_UUID *= *[\"']\([^\"']*\).*/\1/p" "$1"
 
34
}
 
35
 
 
36
configure_cluster_uuid(){
 
37
    # The cluster uuid goes into maas_cluster.conf, but we also still
 
38
    # keep a copy in maas_local_celeryconfig_cluster.py (hopefully just
 
39
    # temporarily).  If an old uuid is configured, we replicate that to
 
40
    # maas_cluster.conf; otherwise, we want to generate one.
 
41
    local uuid
 
42
 
 
43
 
 
44
    if [ -n "$(extract_cluster_uuid /etc/maas/maas_cluster.conf)" ]; then
 
45
        # UUID is already set up.  Wonderful.
 
46
        return
 
47
    fi
 
48
 
 
49
    # Look for a UUID stored in the old location.
 
50
    uuid="$(extract_cluster_uuid /etc/maas/maas_local_celeryconfig_cluster.py)"
 
51
 
 
52
    if [ -z "$uuid" ]; then
 
53
        # No UUID at all yet.  Generate one, and insert it into its
 
54
        # placeholder in the old config location.
 
55
        uuid="$(uuidgen)"
 
56
        sed -i "s|^CLUSTER_UUID = None$|CLUSTER_UUID = '$uuid'|" \
 
57
            /etc/maas/maas_local_celeryconfig_cluster.py
 
58
    fi
 
59
 
 
60
    # Either way, at this point we have a uuid, and it is configured in
 
61
    # the old config location.
 
62
    #
 
63
    # Write it to maas_cluster.conf as well.  There is no initial
 
64
    # placeholder in this file, so just append the setting.
 
65
    echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf
 
66
}
 
67
 
 
68
 
20
69
if [ "$1" = "configure" ] && [ -z "$2" ]; then
21
70
    # logging
22
71
    create_log_dir
23
 
 
24
 
    # The local celery config may contain a private cluster UUID.  Only
25
 
    # maas can read it; only root can write it.
26
 
    chown root:maas /etc/maas/maas_local_celeryconfig_cluster.py
27
 
    chmod 0640 /etc/maas/maas_local_celeryconfig_cluster.py
28
 
 
29
 
    # Generate cluster UUID.
30
 
    if grep -qs "^CLUSTER_UUID\ \= None$" /etc/maas/maas_local_celeryconfig_cluster.py; then
31
 
        uuid="$(uuidgen)"
32
 
        sed -i "s|^CLUSTER_UUID\ \= None$|CLUSTER_UUID = '"$uuid"'|" \
33
 
                       /etc/maas/maas_local_celeryconfig_cluster.py
34
 
    fi
 
72
    configure_maas_tgt
35
73
fi
36
74
 
37
75
if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
40
78
        create_log_dir
41
79
    fi
42
80
 
43
 
    # Get the MAAS_URL on configure/reconfigure and write it to the conf file.
 
81
    # Get the MAAS_URL on configure/reconfigure and write it to the conf files.
44
82
    db_get maas-cluster-controller/maas-url || true
45
83
    if [ -n "$RET" ]; then
46
84
        sed -i "s|MAAS_URL=.*|MAAS_URL="$RET"|" /etc/maas/maas_cluster.conf
 
85
        # Extract the hostname part.
 
86
        HOSTPART=$(echo $RET|awk '{ split($0,array,"/")} END{print array[3] }')
 
87
        # And substitute it in-place in pserv.yaml on an indented, non-commented
 
88
        # line.
 
89
        sed -ri "s|^([[:space:]]+)(#+[[:space:]]*)?(generator:[[:space:]]+https?://)[^:/]+|\1\3$HOSTPART|" /etc/maas/pserv.yaml
47
90
    fi
48
91
fi
49
92
 
 
93
if [ "$1" = "configure" ]; then
 
94
    # These config files may contain a private cluster UUID.  Only maas
 
95
    # can read them; only root can write them
 
96
    chown root:maas \
 
97
        /etc/maas/maas_local_celeryconfig_cluster.py \
 
98
        /etc/maas/maas_cluster.conf
 
99
    chmod 0640 \
 
100
        /etc/maas/maas_local_celeryconfig_cluster.py \
 
101
        /etc/maas/maas_cluster.conf
 
102
 
 
103
    configure_cluster_uuid
 
104
fi
 
105
 
50
106
#DEBHELPER#
51
107
exit 0