Skip to content

Commit 2aa99a6

Browse files
committed
Merge pull request #997 from deis/makefile-fleet-var
refactor(Makefile): use var for `fleetctl` command
2 parents 7afc6de + a1a214f commit 2aa99a6

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

Makefile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Deis Makefile
33
#
44

5+
ifndef FLEETCTL
6+
FLEETCTL = fleetctl --strict-host-key-checking=false
7+
endif
8+
59
ifndef FLEETCTL_TUNNEL
610
$(error You need to set FLEETCTL_TUNNEL to the IP address of a server in the cluster.)
711
endif
@@ -28,7 +32,7 @@ define ssh_all
2832
endef
2933

3034
define check_for_errors
31-
@if fleetctl --strict-host-key-checking=false list-units | egrep -q "(failed|dead)"; then \
35+
@if $(FLEETCTL) list-units | egrep -q "(failed|dead)"; then \
3236
echo "\033[0;31mOne or more services failed! Check which services by running 'make status'\033[0m" ; \
3337
echo "\033[0;31mYou can get detailed output with 'fleetctl status deis-servicename.service'\033[0m" ; \
3438
echo "\033[0;31mThis usually indicates an error with Deis - please open an issue on GitHub or ask for help in IRC\033[0m" ; \
@@ -54,7 +58,7 @@ build:
5458
$(call ssh_all,'cd share && for c in $(ALL_COMPONENTS); do cd $$c && docker build -t deis/$$c . && cd ..; done')
5559

5660
check-fleet:
57-
@LOCAL_VERSION=`fleetctl -version`; \
61+
@LOCAL_VERSION=`$(FLEETCTL) -version`; \
5862
REMOTE_VERSION=`ssh -o StrictHostKeyChecking=no core@$(subst :, -p ,$(FLEETCTL_TUNNEL)) fleetctl -version`; \
5963
if [ "$$LOCAL_VERSION" != "$$REMOTE_VERSION" ]; then \
6064
echo "Your fleetctl client version should match the server. Local version: $$LOCAL_VERSION, server version: $$REMOTE_VERSION. Uninstall your local version and install the latest build from https://github.com/coreos/fleet/releases"; exit 1; \
@@ -67,7 +71,7 @@ full-clean: clean
6771
$(call ssh_all,'for c in $(ALL_COMPONENTS); do docker rmi deis-$$c; done')
6872

6973
install: check-fleet
70-
fleetctl --strict-host-key-checking=false submit $(START_UNITS)
74+
$(FLEETCTL) submit $(START_UNITS)
7175

7276
pull:
7377
$(call ssh_all,'for c in $(ALL_COMPONENTS); do docker pull deis/$$c; done')
@@ -80,8 +84,8 @@ routers:
8084
@router_num=$(DEIS_FIRST_ROUTER) ; \
8185
i=1 ; while [ $$i -le $(DEIS_NUM_ROUTERS) ] ; do \
8286
cp router/systemd/deis-router.service ./deis-router.$$router_num.service ; \
83-
fleetctl --strict-host-key-checking=false submit ./deis-router.$$router_num.service ; \
84-
fleetctl --strict-host-key-checking=false start ./deis-router.$$router_num.service ; \
87+
$(FLEETCTL) submit ./deis-router.$$router_num.service ; \
88+
$(FLEETCTL) start ./deis-router.$$router_num.service ; \
8589
rm -f ./deis-router.$$router_num.service ; \
8690
i=`expr $$i + 1` ; \
8791
router_num=`expr $$router_num + 1` ; \
@@ -92,35 +96,35 @@ run: install start
9296
start: check-fleet routers
9397
@# registry logger cache database
9498
$(call echo_yellow,"Starting Deis! Deis will be functional once all services are reported as running... ")
95-
fleetctl --strict-host-key-checking=false start $(START_UNITS)
99+
$(FLEETCTL) start $(START_UNITS)
96100
$(call echo_yellow,"Waiting for deis-registry to start (this can take some time)... ")
97-
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-registry.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "registry" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
101+
@until $(FLEETCTL) list-units | egrep -q "deis-registry.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | grep "registry" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
98102
$(call check_for_errors)
99103

100104
@# controller
101105
$(call echo_yellow,"Done! Waiting for deis-controller...")
102-
fleetctl --strict-host-key-checking=false submit controller/systemd/*
103-
fleetctl --strict-host-key-checking=false start controller/systemd/*
104-
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-controller.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "controller" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
106+
$(FLEETCTL) submit controller/systemd/*
107+
$(FLEETCTL) start controller/systemd/*
108+
@until $(FLEETCTL) list-units | egrep -q "deis-controller.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | grep "controller" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
105109
$(call check_for_errors)
106110

107111
@# builder
108112
$(call echo_yellow,"Done! Waiting for deis-builder to start (this can also take some time)... ")
109-
fleetctl --strict-host-key-checking=false submit builder/systemd/*
110-
fleetctl --strict-host-key-checking=false start builder/systemd/*
111-
@until fleetctl --strict-host-key-checking=false list-units | egrep -q "deis-builder.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; fleetctl --strict-host-key-checking=false list-units | grep "builder" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
113+
$(FLEETCTL) submit builder/systemd/*
114+
$(FLEETCTL) start builder/systemd/*
115+
@until $(FLEETCTL) list-units | egrep -q "deis-builder.+(running|failed|dead)"; do printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | grep "builder" | awk '{printf $$3}'; printf "\r" ; sleep 10; done
112116
$(call check_for_errors)
113117

114118
$(call echo_yellow,"Your Deis cluster is ready to go! Continue following the README to login and use Deis.")
115119

116120
status: check-fleet
117-
fleetctl --strict-host-key-checking=false list-units
121+
$(FLEETCTL) list-units
118122

119123
stop: check-fleet
120-
fleetctl --strict-host-key-checking=false stop $(ALL_UNITS)
124+
$(FLEETCTL) stop $(ALL_UNITS)
121125

122126
tests:
123127
cd test && bundle install && bundle exec rake
124128

125129
uninstall: check-fleet stop
126-
fleetctl --strict-host-key-checking=false destroy $(ALL_UNITS)
130+
$(FLEETCTL) destroy $(ALL_UNITS)

0 commit comments

Comments
 (0)