~jtv/maas/pkg-bug-1373261

« back to all changes in this revision

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

  • Committer: Jeroen Vermeulen
  • Date: 2014-11-07 18:25:34 UTC
  • Revision ID: jtv@canonical.com-20141107182534-7jx1v9wk1me2b615
Use new 'maas-provision configure-maas-url' command to (re)configure MAAS_URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
    fi
109
109
}
110
110
 
111
 
configure_pserv_generator(){
 
111
configure_maas_url(){
112
112
    # Get the MAAS_URL on configure/reconfigure and write it to the conf files.
113
113
    db_get maas-cluster-controller/maas-url || true
114
114
    if [ -n "$RET" ]; then
115
 
        sed -i "s|MAAS_URL=.*|MAAS_URL=\"$RET\"|" /etc/maas/maas_cluster.conf
116
 
        # Extract the hostname part.
117
 
        HOSTPART=$(echo $RET|awk '{ split($0,array,"/")} END{print array[3] }')
118
 
        # And substitute it in-place in pserv.yaml on an indented, non-commented
119
 
        # line.
120
 
        sed -ri "s|^([[:space:]]+)(#+[[:space:]]*)?(generator:[[:space:]]+https?://)[^:/]+|\1\3$HOSTPART|" /etc/maas/pserv.yaml
 
115
        maas-provision configure-maas-url "$RET"
121
116
    fi
122
117
}
123
118
 
142
137
    fi
143
138
 
144
139
    configure_maas_tgt
145
 
    configure_pserv_generator
 
140
    configure_maas_url
146
141
    # Only ask for a shared secret when the region is not installed
147
142
    # on the same system.
148
143
    if [ -n "$DEBCONF_RECONFIGURE" ] && [ ! -f /usr/sbin/maas-region-admin ]; then