From c271b3ea1fe16561b7a46507fdf961668182b256 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Mon, 3 Oct 2016 16:00:33 -0700 Subject: [PATCH] Update OpenStackClient role list commands This command is deprecated. The new command is role assignment list. Change-Id: I8dba0be21d5af6751bea13d8ff29cd4b7589ab3e --- doc/source/guides/multinode-lab.rst | 2 +- exercises/neutron-adv-test.sh | 2 +- functions-common | 32 +++++++++-------------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/doc/source/guides/multinode-lab.rst b/doc/source/guides/multinode-lab.rst index c996f95743..8751eb8d6a 100644 --- a/doc/source/guides/multinode-lab.rst +++ b/doc/source/guides/multinode-lab.rst @@ -260,7 +260,7 @@ for scripting: openstack user create $NAME --password=$PASSWORD --project $PROJECT openstack role add Member --user $NAME --project $PROJECT # The Member role is created by stack.sh - # openstack role list + # openstack role assignment list Swift ----- diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index dc6bbbb5c7..e003c56331 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -148,7 +148,7 @@ function get_user_id { function get_role_id { local ROLE_NAME=$1 local ROLE_ID - ROLE_ID=`openstack role list | grep $ROLE_NAME | awk '{print $2}'` + ROLE_ID=`openstack role assignment list | grep $ROLE_NAME | awk '{print $2}'` die_if_not_set $LINENO ROLE_ID "Failure retrieving ROLE_ID for $ROLE_NAME" echo "$ROLE_ID" } diff --git a/functions-common b/functions-common index 9544c8102f..87e6bb453d 100644 --- a/functions-common +++ b/functions-common @@ -865,11 +865,9 @@ function get_or_add_user_project_role { domain_args=$(_get_domain_args $4 $5) # Gets user role id - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ - --column "ID" \ --project $3 \ - --column "Name" \ $domain_args \ | grep " $1 " | get_field 1) if [[ -z "$user_role_id" ]]; then @@ -878,11 +876,9 @@ function get_or_add_user_project_role { --user $2 \ --project $3 \ $domain_args - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ - --column "ID" \ --project $3 \ - --column "Name" \ $domain_args \ | grep " $1 " | get_field 1) fi @@ -894,22 +890,18 @@ function get_or_add_user_project_role { function get_or_add_user_domain_role { local user_role_id # Gets user role id - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ - --column "ID" \ --domain $3 \ - --column "Name" \ | grep " $1 " | get_field 1) if [[ -z "$user_role_id" ]]; then # Adds role to user and get it openstack role add $1 \ --user $2 \ --domain $3 - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ - --column "ID" \ --domain $3 \ - --column "Name" \ | grep " $1 " | get_field 1) fi echo $user_role_id @@ -920,13 +912,11 @@ function get_or_add_user_domain_role { function get_or_add_user_domain_role { local user_role_id # Gets user role id - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-identity-api-version=3 \ - --column "ID" \ --domain $3 \ - --column "Name" \ | grep " $1 " | get_field 1) if [[ -z "$user_role_id" ]]; then # Adds role to user and get it @@ -935,13 +925,11 @@ function get_or_add_user_domain_role { --domain $3 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-identity-api-version=3 - user_role_id=$(openstack role list \ + user_role_id=$(openstack role assignment list \ --user $2 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-identity-api-version=3 \ - --column "ID" \ --domain $3 \ - --column "Name" \ | grep " $1 " | get_field 1) fi echo $user_role_id @@ -952,19 +940,19 @@ function get_or_add_user_domain_role { function get_or_add_group_project_role { local group_role_id # Gets group role id - group_role_id=$(openstack role list \ + group_role_id=$(openstack role assignment list \ --group $2 \ --project $3 \ - -c "ID" -f value) + -f value) if [[ -z "$group_role_id" ]]; then # Adds role to group and get it openstack role add $1 \ --group $2 \ --project $3 - group_role_id=$(openstack role list \ + group_role_id=$(openstack role assignment list \ --group $2 \ --project $3 \ - -c "ID" -f value) + -f value) fi echo $group_role_id }