2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
13 if [ -n "$tmpDir" ]; then
25 tmpDir=`mktemp -d /tmp/deaXXXX`
27 export PATH=`dirname $0`:$PATH
30 error_exit "Argument error"
35 if [ ! -f "$deafile" ]; then
36 error_exit "Can't find $deafile"
39 if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then
40 error_exit "Not exactly one environment"
42 envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'`
44 fuel settings --env $envId --download --dir $tmpDir > /dev/null || \
45 error_exit "Could not get settings"
47 fuel network --env $envId --download --dir $tmpDir > /dev/null || \
48 error_exit "Could not get network settings"
50 cp $tmpDir/network_${envId}.yaml network_before.yaml
52 # Transplant network settings
53 transplant_network_settings.py $tmpDir/network_${envId}.yaml $deafile || \
54 error_exit "Could not transplant network settings"
55 fuel network --env $envId --upload --dir $tmpDir || \
56 error_exit "Could not update network settings"
57 cp $tmpDir/network_${envId}.yaml network_after.yaml
60 cp $tmpDir/settings_${envId}.yaml settings_before.yaml
61 transplant_settings.py $tmpDir/settings_${envId}.yaml $deafile || \
62 error_exit "Could not transplant settings"
63 fuel settings --env $envId --upload --dir $tmpDir || \
64 error_exit "Could not update settings"
65 cp $tmpDir/settings_${envId}.yaml settings_after.yaml