Skip to content

Commit

Permalink
Fixing timing issue when creating tables
Browse files Browse the repository at this point in the history
  • Loading branch information
benrady committed May 10, 2016
1 parent 2bd00ad commit c430db1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sspa
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,17 @@ function create_table() {
--table-name $table_name \
--cli-input-json "file://${table_dir}/config.json" \
> ${table_dir}/table_info.json

echo -n "Waiting for table creation..."
aws --profile admin dynamodb describe-table --table-name "$table_name" > ${table_dir}/table_info.json
while [[ "$(support/jsed.py ${table_dir}/table_info.json 'Table.TableStatus')" != "ACTIVE" ]]; do
aws --profile admin dynamodb describe-table --table-name "$table_name" > ${table_dir}/table_info.json
echo -n .
done
echo "...done!"
fi

local table_arn=$(support/jsed.py ${table_dir}/table_info.json 'TableDescription.TableArn')
local table_arn=$(support/jsed.py ${table_dir}/table_info.json 'Table.TableArn')
generate_table_policy ${table_arn} > ${table_dir}/role_policy.json
aws --profile $profile iam put-role-policy \
--policy-document file://${table_dir}/role_policy.json \
Expand Down

0 comments on commit c430db1

Please sign in to comment.