Add option for hypervisor and therefore re-jig read_config
This commit is contained in:
parent
c83756a3e9
commit
2b57cff585
4
TODO.md
4
TODO.md
@ -1,7 +1,7 @@
|
||||
# Todo
|
||||
|
||||
1. add the hypervisor as a flag rather then the configuration file when adding
|
||||
hypervisors.
|
||||
1. ~~add the hypervisor as a flag rather then the configuration file when adding
|
||||
hypervisors.~~
|
||||
1. ~~Add script to cloud-init, that will allow to wipe disk. This will allow to
|
||||
reboot the hypervisor, such that we don't have to log back in after the
|
||||
machine has been re-commissioned.~~
|
||||
|
@ -1 +0,0 @@
|
||||
asrock01.config
|
27
functions.sh
27
functions.sh
@ -136,20 +136,29 @@ maas_add_node()
|
||||
[[ $machine_type == "physical" ]] && maas_create_partitions ${system_id}
|
||||
}
|
||||
|
||||
read_config()
|
||||
read_configs()
|
||||
{
|
||||
configs=""
|
||||
configs+=" configs/default.config"
|
||||
configs+=" configs/maas.config"
|
||||
configs+=" configs/hypervisor.config"
|
||||
if [[ "$0" == "*manage-maas-*" ]] ; then
|
||||
configs+=" configs/hypervisor.config"
|
||||
fi
|
||||
|
||||
for config in $configs ; do
|
||||
if [ ! -f $config ]; then
|
||||
printf "Error: missing config file. Please create the file '$config'.\n"
|
||||
exit 1
|
||||
else
|
||||
shopt -s extglob
|
||||
source "$config"
|
||||
fi
|
||||
read_config $config
|
||||
done
|
||||
}
|
||||
|
||||
read_config()
|
||||
{
|
||||
config=$1
|
||||
|
||||
if [ ! -f $config ]; then
|
||||
printf "Error: missing config file. Please create the file '$config'.\n"
|
||||
exit 1
|
||||
else
|
||||
shopt -s extglob
|
||||
source "$config"
|
||||
fi
|
||||
}
|
||||
|
@ -143,40 +143,47 @@ deploy_node() {
|
||||
show_help() {
|
||||
echo "
|
||||
|
||||
-a Create and Deploy
|
||||
-c Creates Hypervisor
|
||||
-d Deploy Hypervisor
|
||||
-k Add Hypervisor as Pod
|
||||
-n Assign Networks
|
||||
-p Update Partitioning
|
||||
-w Removes Hypervisor
|
||||
-a <node> Create and Deploy
|
||||
-c <node> Creates Hypervisor
|
||||
-d <node> Deploy Hypervisor
|
||||
-k <node> Add Hypervisor as Pod
|
||||
-n <node> Assign Networks
|
||||
-p <node> Update Partitioning
|
||||
-w <node> Removes Hypervisor
|
||||
"
|
||||
}
|
||||
|
||||
read_config
|
||||
read_configs
|
||||
|
||||
while getopts ":cwdaknp" opt; do
|
||||
while getopts ":c:w:d:a:k:n:p:" opt; do
|
||||
case $opt in
|
||||
c)
|
||||
read_config "configs/$OPTARG.config"
|
||||
create_node
|
||||
;;
|
||||
w)
|
||||
read_config "configs/$OPTARG.config"
|
||||
wipe_node
|
||||
;;
|
||||
d)
|
||||
read_config "configs/$OPTARG.config"
|
||||
install_node
|
||||
;;
|
||||
a)
|
||||
read_config "configs/$OPTARG.config"
|
||||
create_node
|
||||
install_node
|
||||
;;
|
||||
k)
|
||||
read_config "configs/$OPTARG.config"
|
||||
add_pod
|
||||
;;
|
||||
n)
|
||||
read_config "configs/$OPTARG.config"
|
||||
network_auto
|
||||
;;
|
||||
p)
|
||||
read_config "configs/$OPTARG.config"
|
||||
create_partitions
|
||||
;;
|
||||
\?)
|
||||
@ -184,5 +191,10 @@ while getopts ":cwdaknp" opt; do
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
: )
|
||||
printf "Option -%s needs an argument.\n" "$OPTARG" >&2
|
||||
show_help
|
||||
echo ""
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
@ -417,7 +417,7 @@ show_help() {
|
||||
}
|
||||
|
||||
# Initialise the configs
|
||||
read_config
|
||||
read_configs
|
||||
|
||||
while getopts ":cwjdnr" opt; do
|
||||
case $opt in
|
||||
|
Loading…
x
Reference in New Issue
Block a user