Skip to content

Commit 6bd1fc1

Browse files
committed
Tweak tr command to work on OSX. Chef object deletion should use $node_name. deis/deis#396
1 parent 78efe2c commit 6bd1fc1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

contrib/digitalocean/provision-digitalocean-controller.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ fi
4141
#################
4242
# chef settings #
4343
#################
44-
node_name="deis-controller-$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 5 | xargs)"
44+
node_name="deis-controller-$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 5 | xargs)"
4545
run_list="recipe[deis::controller]"
4646
chef_version=11.6.2
4747

48+
if [ $node_name = 'deis-controller-' ]; then
49+
echo "Couldn't generate unique name for deis-controller. Aborting."
50+
exit 1
51+
fi
52+
4853
#########################
4954
# digitalocean settings #
5055
#########################
@@ -124,11 +129,11 @@ if [ $result -ne 0 ]; then
124129
knife digital_ocean droplet destroy -S $droplet_id
125130
# Remove node and client from Chef Server
126131
echo_color "Deleting Chef client..."
127-
knife client delete deis-controller -y
132+
knife client delete $node_name -y
128133
echo_color "Deleting Chef node..."
129-
knife node delete deis-controller -y
134+
knife node delete $node_name -y
130135
else
131136
echo_color "Knife bootstrap successful."
132137
# Need Chef admin permission in order to add and remove nodes and clients
133-
echo -e "\033[35mPlease ensure that \"deis-controller\" is added to the Chef \"admins\" group.\033[0m"
138+
echo -e "\033[35mPlease ensure that \"$node_name\" is added to the Chef \"admins\" group.\033[0m"
134139
fi

0 commit comments

Comments
 (0)