components/openstack/heat/patches/06-heat-keystone-setup.patch
changeset 5405 66fd59fecd68
parent 5404 55e409ba4e72
child 5406 5ac656f02914
equal deleted inserted replaced
5404:55e409ba4e72 5405:66fd59fecd68
     1 In-house patch to the heat-keystone-setup script installed in
       
     2 /usr/demo/openstack/keystone in order to use the standard Solaris UNIX
       
     3 commands rather than the GNU ones. It also includes a corrected fix for
       
     4 Launchpad bug 1260556. This is a Solaris-specific patch and is not
       
     5 suitable for the upstream.
       
     6 
       
     7 --- heat-2014.2.2/bin/heat-keystone-setup.orig	2014-08-07 15:08:53.000000000 -0700
       
     8 +++ heat-2014.2.2/bin/heat-keystone-setup	2014-09-20 21:44:41.866870651 -0700
       
     9 @@ -2,12 +2,14 @@
       
    10  
       
    11  set +e
       
    12  
       
    13 +PATH=/usr/bin
       
    14 +
       
    15  KEYSTONE_CONF=${KEYSTONE_CONF:-/etc/keystone/keystone.conf}
       
    16  
       
    17  # Extract some info from Keystone's configuration file
       
    18  if [[ -r "$KEYSTONE_CONF" ]]; then
       
    19 -    CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
       
    20 -    CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
       
    21 +    CONFIG_SERVICE_TOKEN=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
       
    22 +    CONFIG_ADMIN_PORT=$(tr -d '[\t ]' < $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
       
    23  fi
       
    24  
       
    25  SERVICE_TOKEN=${OS_SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}
       
    26 @@ -102,7 +104,7 @@ get_data() {
       
    27      shift 3
       
    28  
       
    29      output=$("$@" | \
       
    30 -           awk -F'|' \
       
    31 +           nawk -F'|' \
       
    32                 "! /^\+/ && \$${match_column} ~ \"^ *${regex} *\$\" \
       
    33                  { print \$${output_column} }")
       
    34  
       
    35 @@ -116,7 +118,7 @@ get_id () {
       
    36  get_column_num() {
       
    37      local name=$1
       
    38      shift
       
    39 -    $@ | awk -F'|' "NR == 2 && /^|/ { for (i=2; i<NF; i++) if (\$i ~ \"^ *${name} *\$\") print (i - 1) }"
       
    40 +    $@ | nawk -F'|' "NR == 2 && /^\|/ { for (i=2; i<NF; i++) if (\$i ~ \"^ *${name} *\$\") print (i - 1) }"
       
    41  }
       
    42  
       
    43  get_user() {
       
    44 @@ -208,7 +210,7 @@ delete_endpoint() {
       
    45  
       
    46      local url=$(get_data 1 "${service_type}[.]publicURL" 2 \
       
    47                  get_endpoint $service_type 2>/dev/null | \
       
    48 -                sed -r "s/[a-f0-9]{32}/$urlsuffix/")
       
    49 +                sed "s/[a-f0-9]\{32\}/$urlsuffix/")
       
    50  
       
    51      if [ -n "$url" ]; then
       
    52          local endpoints=$(get_data 3 $url 1 keystone endpoint-list)
       
    53 @@ -280,7 +282,7 @@ keystone_setup() {
       
    54      die_if_not_set $LINENO ADMIN_ROLE "Fail to get ADMIN_ROLE by 'keystone role-list' "
       
    55      SERVICE_TENANT=$(get_data 2 service 1 keystone tenant-list)
       
    56      die_if_not_set $LINENO SERVICE_TENANT "Fail to get service tenant 'keystone tenant-list' "
       
    57 -    SERVICE_PASSWORD=${SERVICE_PASSWORD:-$OS_PASSWORD}
       
    58 +    SERVICE_PASSWORD=${SERVICE_PASSWORD:-heat}
       
    59      SERVICE_HOST=${SERVICE_HOST:-localhost}
       
    60  
       
    61      if [[ "$SERVICE_PASSWORD" == "$OS_PASSWORD" ]]; then