From e3bc6b5f571a5b291617ee5227c153002ef8d9c3 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 24 Sep 2019 12:44:16 +1000 Subject: [PATCH] get_or_create_domain: simplify with "--or-show" argument Similar to other functions, this uses "--or-show" to avoid double calls. Co-Authored-By: Jens Harbott Change-Id: I548f9acd812687838e04b705f86f3b70d2b10caf --- functions-common | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/functions-common b/functions-common index 92a6678de0..ed44186804 100644 --- a/functions-common +++ b/functions-common @@ -875,14 +875,9 @@ function policy_add { # Usage: get_or_create_domain function get_or_create_domain { local domain_id - # Gets domain id domain_id=$( - # Gets domain id - openstack --os-cloud devstack-system-admin domain show $1 \ - -f value -c id 2>/dev/null || - # Creates new domain openstack --os-cloud devstack-system-admin domain create $1 \ - --description "$2" \ + --description "$2" --or-show \ -f value -c id ) echo $domain_id