[CLI] Add support for emtpy deployment

If no platform is used config is looking like {} and it actually
doesn't make any sense to force someone to create file for that

This patch allows to create a empty deployment if there is no
--filename and --fromenv arguments

Change-Id: I15ca37fdf74b153cc2727b6293b841de42227e9f
This commit is contained in:
Boris Pavlovic 2017-09-07 16:00:02 -07:00 committed by Andrey Kurilin
parent 62341e1f1c
commit 60b3c4302e
2 changed files with 6 additions and 3 deletions

View File

@ -22,7 +22,6 @@ fi
RND=$(head /dev/urandom | tr -dc a-z0-9 | head -c 5)
TMP_RALLY_CONF="/tmp/self-rally-$RND.conf"
TMP_RALLY_DB="/tmp/self-rally-$RND.sqlite"
TMP_RALLY_DEPLOYMENT="/tmp/self-rally-dep-$RND.json"
DBCONNSTRING="sqlite:///$TMP_RALLY_DB"
RALLY="rally --config-file $TMP_RALLY_CONF"
@ -32,8 +31,7 @@ sed -i.bak "s|#connection =.*|connection = \"$DBCONNSTRING\"|" $TMP_RALLY_CONF
rally --config-file $TMP_RALLY_CONF db create
# Create self deployment
echo '{}' > $TMP_RALLY_DEPLOYMENT
$RALLY -d deployment create --file=$TMP_RALLY_DEPLOYMENT --name=self
$RALLY -d deployment create --name=self
# Run task
$RALLY -d --plugin-paths=$PLUGIN_PATHS task start $TASK_FILE

View File

@ -43,6 +43,11 @@ class DeploymentTestCase(unittest.TestCase):
"--filename /tmp/.tmp.deployment")
self.assertIn("t_create_file", rally("deployment list"))
def test_create_empty(self):
rally = utils.Rally()
rally("deployment create --name t_empty")
self.assertEqual("{}", rally("deployment config"))
def test_config(self):
rally = utils.Rally()
rally.env.update(utils.TEST_ENV)