@@ -19,7 +19,6 @@ DEFAULT_PASSWORD="SomeSecurePassword!"
19
19
password=" ${CODER_DEV_ADMIN_PASSWORD:- ${DEFAULT_PASSWORD} } "
20
20
use_proxy=0
21
21
multi_org=0
22
- first_org=" coder"
23
22
24
23
args=" $( getopt -o " " -l access-url:,use-proxy,agpl,debug,password:,multi-organization -- " $@ " ) "
25
24
eval set -- " $args "
@@ -204,6 +203,8 @@ fatal() {
204
203
# If we have docker available and the "docker" template doesn't already
205
204
# exist, then let's try to create a template!
206
205
template_name=" docker"
206
+ # Determine the name of the default org with some jq hax!
207
+ first_org_name=$( " ${CODER_DEV_SHIM} " organizations show me -o json | jq -r ' .[] | select(.is_default) | .name' )
207
208
if docker info > /dev/null 2>&1 && ! " ${CODER_DEV_SHIM} " templates versions list " ${template_name} " > /dev/null 2>&1 ; then
208
209
# sometimes terraform isn't installed yet when we go to create the
209
210
# template
@@ -217,8 +218,8 @@ fatal() {
217
218
DOCKER_HOST=" $( docker context inspect --format ' {{ .Endpoints.docker.Host }}' ) "
218
219
printf ' docker_arch: "%s"\ndocker_host: "%s"\n' " ${GOARCH} " " ${DOCKER_HOST} " > " ${temp_template_dir} /params.yaml"
219
220
(
220
- echo " Pushing docker template to '${first_org } '..."
221
- " ${CODER_DEV_SHIM} " templates push " ${template_name} " --directory " ${temp_template_dir} " --variables-file " ${temp_template_dir} /params.yaml" --yes --org " ${first_org } "
221
+ echo " Pushing docker template to '${first_org_name } '..."
222
+ " ${CODER_DEV_SHIM} " templates push " ${template_name} " --directory " ${temp_template_dir} " --variables-file " ${temp_template_dir} /params.yaml" --yes --org " ${first_org_name } "
222
223
if [ " ${multi_org} " -gt " 0" ]; then
223
224
echo " Pushing docker template to '${another_org} '..."
224
225
" ${CODER_DEV_SHIM} " templates push " ${template_name} " --directory " ${temp_template_dir} " --variables-file " ${temp_template_dir} /params.yaml" --yes --org " ${another_org} "
0 commit comments