Skip to content

Commit 910146f

Browse files
committed
Check for DO credentials in ENV first then fallback to knife.rb. Add -y to Chef deletion commands.
1 parent 0b8ed93 commit 910146f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

contrib/digitalocean/provision-digitalocean-controller.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ if ! $CONTRIB_DIR/check-deis-deps.sh; then
2424
fi
2525

2626
# connection details for using digital ocean's API
27-
client_id=$(knife exec -E"puts Chef::Config[:knife][:digital_ocean_client_id]")
28-
api_key=$(knife exec -E"puts Chef::Config[:knife][:digital_ocean_api_key]")
27+
client_id=${DIGITALOCEAN_CLIENT_ID:-$(knife exec -E"puts Chef::Config[:knife][:digital_ocean_client_id]")}
28+
api_key=${DIGITALOCEAN_API_KEY:-$(knife exec -E"puts Chef::Config[:knife][:digital_ocean_api_key]")}
2929

3030
# Check that client ID and API key was set
3131
if test -z $client_id; then
32-
echo "Please add your client id to ${knife_file}."
32+
echo "Please add your Digital Ocean Client ID to the shell's environment or knife.rb."
3333
fi
3434

3535
if test -z $api_key; then
36-
echo "Please add your api key to ${knife_file}."
36+
echo "Please add your Digital Ocean API Key to the shell's environment or knife.rb."
3737
fi
3838

3939
#################
@@ -122,9 +122,9 @@ if [ $result -ne 0 ]; then
122122
knife digital_ocean droplet destroy -S $droplet_id
123123
# Remove node and client from Chef Server
124124
echo_color "Deleting Chef client..."
125-
knife client delete deis-controller
125+
knife client delete deis-controller -y
126126
echo_color "Deleting Chef node..."
127-
knife node delete deis-controller
127+
knife node delete deis-controller -y
128128
else
129129
echo_color "Knife bootstrap successful."
130130
# Need Chef admin permission in order to add and remove nodes and clients

0 commit comments

Comments
 (0)