Refresh now sets missing config values

Broke default config settings into a separate script, which the
install hook always called, and post-refresh calls if it can't find
the new config hierarchy.

This fixes issues w/ upgrading from beta to edge.

Change-Id: I6b11109c2a2f6aca142a18c9fa274b332891d5c8
This commit is contained in:
Pete Vander Giessen 2019-11-15 17:50:23 +00:00 committed by Frode Nordahl
parent f7d2064561
commit 590a7bc3d5
3 changed files with 72 additions and 47 deletions

View File

@ -0,0 +1,51 @@
#!/bin/bash
set -ex
# Initialize Config
# TODO: put this in a nice yaml format, and parse it.
# General snap-wide settings
snapctl set \
config.clustered=false \
config.post-setup=true \
;
# Networking related settings.
snapctl set \
config.network.dns=1.1.1.1 \
config.network.ext-gateway=10.20.20.1 \
config.network.control-ip=10.20.20.1 \
config.network.compute-ip=10.20.20.1 \
config.network.ext-cidr=10.20.20.1/24 \
config.network.security-rules=true \
config.network.dashboard-allowed-hosts="*" \
;
# Passwords, certs, etc.
snapctl set \
config.credentials.os-password=keystone \
config.credentials.key-pair=id_microstack \
config.credentials.nova-password=nova \
config.credentials.neutron-password=neutron \
config.credentials.placement-password=placement \
config.credentials.glance-password=glance \
;
# Host optimizations and fixes.
snapctl set \
config.host.ip-forwarding=true \
config.host.check-qemu=true \
;
# Enable or disable groups of services.
snapctl set \
config.services.control-plane=true \
config.services.hypervisor=true \
;
# Clustering roles
snapctl set \
cluster.role=control \
cluster.password=null \
;

View File

@ -1,53 +1,8 @@
#!/bin/bash
set -ex
# Initialize Config
# TODO: put this in a nice yaml format, and parse it.
# General snap-wide settings
snapctl set \
config.clustered=false \
config.post-setup=true \
;
# Networking related settings.
snapctl set \
config.network.dns=1.1.1.1 \
config.network.ext-gateway=10.20.20.1 \
config.network.control-ip=10.20.20.1 \
config.network.compute-ip=10.20.20.1 \
config.network.ext-cidr=10.20.20.1/24 \
config.network.security-rules=true \
config.network.dashboard-allowed-hosts="*" \
;
# Passwords, certs, etc.
snapctl set \
config.credentials.os-password=keystone \
config.credentials.key-pair=id_microstack \
config.credentials.nova-password=nova \
config.credentials.neutron-password=neutron \
config.credentials.placement-password=placement \
config.credentials.glance-password=glance \
;
# Host optimizations and fixes.
snapctl set \
config.host.ip-forwarding=true \
config.host.check-qemu=true \
;
# Enable or disable groups of services.
snapctl set \
config.services.control-plane=true \
config.services.hypervisor=true \
;
# Clustering roles
snapctl set \
cluster.role=control \
cluster.password=null \
;
# Initialize config
set-default-config
# MySQL snapshot for speedy install
# snapshot is a mysql data dir with

19
snap/hooks/post-refresh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -ex
if [ -z "$(snapctl get config)" ]; then
# [2019-11-15] Handle build 171 (beta) -> 182
# We are upgrading from a version of the snap from before we put all
# config values under a config tree. Set the default values now (the
# old values were not documented, and we assume that they were not
# set).
set-default-config
# Make a place for our horizon config overrides to live. We piggy
# back on the above check, because the changes were made
# concurrently.
mkdir -p ${SNAP_COMMON}/etc/horizon/local_settings.d
fi
snap-openstack setup # Write any template changes.