add namespace when query configuration
This commit is contained in:
parent
00017de13c
commit
3d5d831a8c
|
@ -1,6 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
|
function get_id() {
|
||||||
|
S=$($1)
|
||||||
|
V=$(echo $S|jq -r .session_id)
|
||||||
|
if [ $? = 0 ]; then
|
||||||
|
echo $V
|
||||||
|
else
|
||||||
|
echo $S
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#=======================================================================================================
|
#=======================================================================================================
|
||||||
# Infrastructure
|
# Infrastructure
|
||||||
#=======================================================================================================
|
#=======================================================================================================
|
||||||
|
@ -22,12 +33,12 @@ cucchiaiata-cli v1.user.role.create --user_login gnunux \
|
||||||
# +~~~~~~~~~~+
|
# +~~~~~~~~~~+
|
||||||
cucchiaiata-cli v1.infra.zone.create --zone_name internet
|
cucchiaiata-cli v1.infra.zone.create --zone_name internet
|
||||||
# zone configuration
|
# zone configuration
|
||||||
S=$(cucchiaiata-cli v1.setting.session.zone.start --zone_name internet | jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.zone.start --zone_name internet")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network.network "192.168.1.0/24" \
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network "192.168.1.0/24" \
|
||||||
--configuration.network.host_start "192.168.1.10" \
|
--configuration.host_start "192.168.1.10" \
|
||||||
--configuration.network.host_stop "192.168.1.100" \
|
--configuration.host_stop "192.168.1.100" \
|
||||||
--configuration.network.dns 192.168.1.2 \
|
--configuration.dns 192.168.1.2 \
|
||||||
--configuration.network.gateway 192.168.1.254
|
--configuration.gateway 192.168.1.254
|
||||||
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
|
||||||
|
@ -46,7 +57,7 @@ cucchiaiata-cli v1.infra.cluster.node.create --node_name node1.cadoles.com \
|
||||||
--zones_name internet
|
--zones_name internet
|
||||||
|
|
||||||
# configuration
|
# configuration
|
||||||
S=$(cucchiaiata-cli v1.setting.session.cluster.start --cluster_name cluster.cadoles.com | jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.cluster.start --cluster_name cluster.cadoles.com")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network.virtual_ip "192.168.1.1"
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.network.virtual_ip "192.168.1.1"
|
||||||
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
@ -88,12 +99,12 @@ cucchiaiata-cli v1.setting.servermodel.create --servermodel_name unbound_etab1 -
|
||||||
# configuration
|
# configuration
|
||||||
|
|
||||||
# Servermodel ACA
|
# Servermodel ACA
|
||||||
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name aca| jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name aca")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_ssh.ssh_allow_networks admin.cadoles.com
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_ssh.ssh_allow_networks admin.cadoles.com
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
|
||||||
# Servermodel unbound
|
# Servermodel unbound
|
||||||
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound| jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_dns.unbound_local_zones cadoles.com \
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.serveur_dns.unbound_local_zones cadoles.com \
|
||||||
--configuration.reseau.unbound_route_address 192.168.1.254 \
|
--configuration.reseau.unbound_route_address 192.168.1.254 \
|
||||||
--configuration.serveur_dns.unbound_allowed_client_cidr 192.168.1.0/24
|
--configuration.serveur_dns.unbound_allowed_client_cidr 192.168.1.0/24
|
||||||
|
@ -105,7 +116,7 @@ cucchiaiata-cli v1.setting.session.configure --session_id "$S" --unbound.unbound
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
|
||||||
# Servermodel unbound_etab1
|
# Servermodel unbound_etab1
|
||||||
S=$(cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound_etab1 | jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.servermodel.start --servermodel_name unbound_etab1")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_domain_name dns.cadoles.com
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_domain_name dns.cadoles.com
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
|
||||||
|
@ -125,12 +136,12 @@ cucchiaiata-cli v1.infra.server.create --server_name dns.cadoles.com \
|
||||||
--servermodel_name unbound_etab1
|
--servermodel_name unbound_etab1
|
||||||
# configuration
|
# configuration
|
||||||
sleep 1
|
sleep 1
|
||||||
S=$(cucchiaiata-cli v1.setting.session.server.start --server dns.cadoles.com | jq -r .session_id)
|
S=$(get_id "cucchiaiata-cli v1.setting.session.server.start --server dns.cadoles.com")
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_ip_address_cidr 192.168.1.2/24
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --configuration.reseau.unbound_ip_address_cidr 192.168.1.2/24
|
||||||
cucchiaiata-cli v1.setting.session.filter --session_id "$S" --namespace opennebula
|
cucchiaiata-cli v1.setting.session.filter --session_id "$S" --namespace opennebula
|
||||||
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --opennebula.configuration.cpu 0.2 \
|
cucchiaiata-cli v1.setting.session.configure --session_id "$S" --opennebula.cpu 0.2 \
|
||||||
--opennebula.configuration.vcpu 2 \
|
--opennebula.vcpu 2 \
|
||||||
--opennebula.configuration.memory 2
|
--opennebula.memory 2
|
||||||
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
cucchiaiata-cli v1.setting.session.validate --session_id $S
|
||||||
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
cucchiaiata-cli v1.setting.session.stop --session_id "$S" --save
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,11 @@ class Configuration(Common):
|
||||||
def get(self):
|
def get(self):
|
||||||
parameters = self.get_parameters()
|
parameters = self.get_parameters()
|
||||||
tiramisu_config = self.configure_server()
|
tiramisu_config = self.configure_server()
|
||||||
|
option = next(tiramisu_config.option.list('all'))
|
||||||
|
namespace = option.option.path().split('.', 1)[0]
|
||||||
parser = TiramisuCmdlineParser(tiramisu_config,
|
parser = TiramisuCmdlineParser(tiramisu_config,
|
||||||
self.prog,
|
self.prog,
|
||||||
|
root=namespace,
|
||||||
unrestraint=True,
|
unrestraint=True,
|
||||||
fullpath=True)
|
fullpath=True)
|
||||||
parser.parse_args(parameters,
|
parser.parse_args(parameters,
|
||||||
|
|
Loading…
Reference in New Issue