Simplify deployment config format

There is upgoing work related to deployment refactoring. The bunch of
different enitities will be removed and inner code will be rewritten
almost from scratch.

This patch introduces a new simpler dedployment config format. Despite
the fact that it requires several workarounds, we need to merge it
before actual refactoring is done, since we want to provide a good
deprecation period and as quicker we introduce a new format as quicker
we will able to remove deprecated stuff:)

An example of old deployment config:

    {
         "type": "ExistingCloud",
         "creds": {
             "openstack": {
                 "auth_url": "https://example.com",
                 "admin": {
                               "username": "admin",
                               "password": "pass",
                               "project_name": "admin"
                 }
             }
         }
    }

An example of a new format:

    {
         "openstack": {
             "auth_url": "https://example.com",
             "admin": {
                           "username": "admin",
                           "password": "pass",
                           "project_name": "admin"
             }
         }
    }

Change-Id: If88317a0aefdd3d1adc6c380672d83e2bad11f15
This commit is contained in:
Andrey Kurilin 2017-08-21 18:57:09 +03:00
parent 27fd7b1b12
commit 57d2a22dfd
10 changed files with 107 additions and 132 deletions

View File

@ -49,16 +49,13 @@ if [[ "$IDENTITY_API_VERSION" == 2.0 ]]
then
cat >$1 <<EOF
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "$OS_AUTH_URL",
"region_name": "$REGION_NAME",
"admin": {
"username": "admin",
"password": "$ADMIN_PASSWORD",
"tenant_name": "admin",
}
"openstack": {
"auth_url": "$OS_AUTH_URL",
"region_name": "$REGION_NAME",
"admin": {
"username": "admin",
"password": "$ADMIN_PASSWORD",
"tenant_name": "admin",
}
}
}
@ -68,18 +65,15 @@ if [[ "$IDENTITY_API_VERSION" == 3 ]]
then
cat >$1 <<EOF
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "$OS_AUTH_URL",
"region_name": "$REGION_NAME",
"admin": {
"username": "admin",
"password": "$ADMIN_PASSWORD",
"project_name": "admin",
"user_domain_name": "Default",
"project_domain_name": "Default"
}
"openstack": {
"auth_url": "$OS_AUTH_URL",
"region_name": "$REGION_NAME",
"admin": {
"username": "admin",
"password": "$ADMIN_PASSWORD",
"project_name": "admin",
"user_domain_name": "Default",
"project_domain_name": "Default"
}
}
}

View File

@ -1,20 +1,17 @@
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"user_domain_name": "admin",
"project_name": "admin",
"project_domain_name": "admin"
},
"https_insecure": false,
"https_cacert": "",
"profiler_hmac_key": "SECRET_KEY"
}
"openstack": {
"auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"user_domain_name": "admin",
"project_name": "admin",
"project_domain_name": "admin"
},
"https_insecure": false,
"https_cacert": "",
"profiler_hmac_key": "SECRET_KEY"
}
}

View File

@ -1,19 +1,16 @@
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"user_domain_name": "admin",
"project_name": "admin",
"project_domain_name": "admin"
},
"https_insecure": false,
"https_cacert": ""
}
"openstack": {
"auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"user_domain_name": "admin",
"project_name": "admin",
"project_domain_name": "admin"
},
"https_insecure": false,
"https_cacert": ""
}
}

View File

@ -1,18 +1,15 @@
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"endpoint": "http://<public-identity-url-ip>:<mgmt-port>/<version>/ example: http://172.16.0.2:35357/v2.0/",
"admin": {
"username": "admin",
"password": "pa55word",
"tenant_name": "demo"
},
"https_insecure": false,
"https_cacert": ""
}
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"endpoint": "http://<public-identity-url-ip>:<mgmt-port>/<version>/ example: http://172.16.0.2:35357/v2.0/",
"admin": {
"username": "admin",
"password": "pa55word",
"tenant_name": "demo"
},
"https_insecure": false,
"https_cacert": ""
}
}

View File

@ -1,27 +1,24 @@
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "pa55word",
"tenant_name": "demo"
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "pa55word",
"tenant_name": "demo"
},
"users": [
{
"username": "not_an_admin1",
"password": "password",
"tenant_name": "some_tenant"
},
"users": [
{
"username": "not_an_admin1",
"password": "password",
"tenant_name": "some_tenant"
},
{
"username": "not_an_admin2",
"password": "password2",
"tenant_name": "some_tenant2"
}
]
}
{
"username": "not_an_admin2",
"password": "password2",
"tenant_name": "some_tenant2"
}
]
}
}

View File

@ -1,17 +1,14 @@
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"tenant_name": "demo"
},
"https_insecure": false,
"https_cacert": ""
}
"openstack": {
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "myadminpass",
"tenant_name": "demo"
},
"https_insecure": false,
"https_cacert": ""
}
}

View File

@ -70,8 +70,7 @@ class TestTaskSamples(unittest.TestCase):
user_ctx.setup()
self.addCleanup(user_ctx.cleanup)
config = deployment["config"]
os_creds = config["creds"]["openstack"]
os_creds = deployment["config"]["creds"]["openstack"]
user = copy.copy(os_creds["admin"])
user["username"] = ctx["users"][0]["credential"].username
@ -81,12 +80,12 @@ class TestTaskSamples(unittest.TestCase):
user["project_name"] = ctx["users"][0]["credential"].tenant_name
else:
user["tenant_name"] = ctx["users"][0]["credential"].tenant_name
config["creds"]["openstack"]["users"] = [user]
os_creds["users"] = [user]
rally("deployment destroy MAIN", write_report=False)
deployment_cfg = os.path.join(rally.tmp_dir, "new_deployment.json")
with open(deployment_cfg, "w") as f:
f.write(json.dumps(config))
f.write(json.dumps({"openstack": os_creds}))
rally("deployment create --name MAIN --filename %s" % deployment_cfg,
write_report=False)

View File

@ -516,7 +516,7 @@ def main():
out = subprocess.check_output(["rally", "deployment", "config",
"--deployment", "devstack"])
config = json.loads(out if six.PY2 else out.decode("utf-8"))
config = config["creds"]["openstack"]
config = config["openstack"]
config.update(config.pop("admin"))
if "users" in config:
del config["users"]

View File

@ -73,25 +73,22 @@ function setUp () {
echo '
{
"type": "ExistingCloud",
"creds": {
"openstack": {
"users": [
{"username": "rally-test-user-1",
"password": "rally-test-password-1",
"project_name": "rally-test-project-1",
"user_domain_name": "Default",
"project_domain_name": "Default"
},
{"username": "rally-test-user-2",
"password": "rally-test-password-2",
"project_name": "rally-test-project-2",
"user_domain_name": "Default",
"project_domain_name": "Default"
}],
"auth_url": "'$OS_AUTH_URL'",
"region_name": "RegionOne"
}
"openstack": {
"users": [
{"username": "rally-test-user-1",
"password": "rally-test-password-1",
"project_name": "rally-test-project-1",
"user_domain_name": "Default",
"project_domain_name": "Default"
},
{"username": "rally-test-user-2",
"password": "rally-test-password-2",
"project_name": "rally-test-project-2",
"user_domain_name": "Default",
"project_domain_name": "Default"
}],
"auth_url": "'$OS_AUTH_URL'",
"region_name": "RegionOne"
}
}
' > $DEPLOYMENT_CONFIG_FILE

View File

@ -32,7 +32,7 @@ sed -i.bak "s|#connection =.*|connection = \"$DBCONNSTRING\"|" $TMP_RALLY_CONF
rally-manage --config-file $TMP_RALLY_CONF db create
# Create self deployment
echo '{"type": "ExistingCloud", "creds": {}}' > $TMP_RALLY_DEPLOYMENT
echo '{}' > $TMP_RALLY_DEPLOYMENT
$RALLY -d deployment create --file=$TMP_RALLY_DEPLOYMENT --name=self
# Run task