Skip to content

Commit 32fd600

Browse files
shakimMatthew Fisher
authored andcommitted
fix(Makefile): force constant output of fleetctl list-units
1 parent bfa0594 commit 32fd600

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

Makefile

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
include includes.mk
66

7+
list-units = list-units --fields unit,state,load,active,sub,desc,machine
8+
79
define check_for_errors
8-
@if $(FLEETCTL) list-units -no-legend | awk '(($$2 == "launched") && ($$5 == "failed"))' | egrep -q "deis-.+service"; then \
10+
@if $(FLEETCTL) $(list-units) -no-legend | awk '(($$2 == "launched") && ($$5 == "failed"))' | egrep -q "deis-.+service"; then \
911
echo "\033[0;31mOne or more services failed! Check which services by running 'make status'\033[0m" ; \
1012
echo "\033[0;31mYou can get detailed output with 'fleetctl status deis-servicename.service'\033[0m" ; \
1113
echo "\033[0;31mThis usually indicates an error with Deis - please open an issue on GitHub or ask for help in IRC\033[0m" ; \
@@ -14,7 +16,7 @@ define check_for_errors
1416
endef
1517

1618
define deis_units
17-
$(shell $(FLEETCTL) list-units -no-legend=true | \
19+
$(shell $(FLEETCTL) $(list-units) -no-legend=true | \
1820
awk '($$2 ~ "$(1)" && ($$4 ~ "$(2)"))' | \
1921
sed -n 's/\(deis-.*\.service\).*/\1/p' | tr '\n' ' ')
2022
endef
@@ -49,7 +51,7 @@ install: check-fleet install-routers install-data-containers
4951
install-data-containers: check-fleet
5052
@$(foreach T, $(DATA_CONTAINER_TEMPLATES), \
5153
UNIT=`basename $(T)` ; \
52-
EXISTS=`$(FLEETCTL) list-units | grep $$UNIT` ; \
54+
EXISTS=`$(FLEETCTL) $(list-units) | grep $$UNIT` ; \
5355
if [ "$$EXISTS" != "" ]; then \
5456
echo $$UNIT already loaded. Skipping... ; \
5557
else \
@@ -85,9 +87,9 @@ start: check-fleet start-warning start-routers
8587
@# logger cache database
8688
$(call echo_yellow,"Waiting for deis-cache to start...")
8789
$(FLEETCTL) start -no-block $(START_UNITS)
88-
@until $(FLEETCTL) list-units | egrep -q "deis-cache\..+(running|failed)"; \
90+
@until $(FLEETCTL) $(list-units) | egrep -q "deis-cache\..+(running|failed)"; \
8991
do sleep 2; \
90-
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | \
92+
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) $(list-units) | \
9193
grep "deis-cache\." | awk '{printf "%-10s (%s) \r", $$4, $$5}'; \
9294
sleep 8; \
9395
done
@@ -96,9 +98,9 @@ start: check-fleet start-warning start-routers
9698
@# registry
9799
$(call echo_yellow,"Waiting for deis-registry to start...")
98100
$(FLEETCTL) start -no-block registry/systemd/*
99-
@until $(FLEETCTL) list-units | egrep -q "deis-registry\..+(running|failed)"; \
101+
@until $(FLEETCTL) $(list-units) | egrep -q "deis-registry\..+(running|failed)"; \
100102
do sleep 2; \
101-
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | \
103+
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) $(list-units) | \
102104
grep "deis-registry\." | awk '{printf "%-10s (%s) \r", $$4, $$5}'; \
103105
sleep 8; \
104106
done
@@ -107,9 +109,9 @@ start: check-fleet start-warning start-routers
107109
@# controller
108110
$(call echo_yellow,"Waiting for deis-controller to start...")
109111
$(FLEETCTL) start -no-block controller/systemd/*
110-
@until $(FLEETCTL) list-units | egrep -q "deis-controller\..+(running|failed)"; \
112+
@until $(FLEETCTL) $(list-units) | egrep -q "deis-controller\..+(running|failed)"; \
111113
do sleep 2; \
112-
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | \
114+
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) $(list-units) | \
113115
grep "deis-controller\." | awk '{printf "%-10s (%s) \r", $$4, $$5}'; \
114116
sleep 8; \
115117
done
@@ -118,9 +120,9 @@ start: check-fleet start-warning start-routers
118120
@# builder
119121
$(call echo_yellow,"Waiting for deis-builder to start...")
120122
$(FLEETCTL) start -no-block builder/systemd/*.service
121-
@until $(FLEETCTL) list-units | egrep -q "deis-builder\..+(running|failed)"; \
123+
@until $(FLEETCTL) $(list-units) | egrep -q "deis-builder\..+(running|failed)"; \
122124
do sleep 2; \
123-
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | \
125+
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) $(list-units) | \
124126
grep "deis-builder\." | awk '{printf "%-10s (%s) \r", $$4, $$5}'; \
125127
sleep 8; \
126128
done
@@ -131,9 +133,9 @@ start: check-fleet start-warning start-routers
131133
start-routers: check-fleet start-warning
132134
$(call echo_yellow,"Waiting for 1 of $(DEIS_NUM_ROUTERS) deis-routers to start...")
133135
$(foreach R,$(ROUTER_UNITS),$(FLEETCTL) start -no-block $(R);)
134-
@until $(FLEETCTL) list-units | egrep -q "deis-router.+(running)"; \
136+
@until $(FLEETCTL) $(list-units) | egrep -q "deis-router.+(running)"; \
135137
do sleep 2; \
136-
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) list-units | \
138+
printf "\033[0;33mStatus:\033[0m "; $(FLEETCTL) $(list-units) | \
137139
grep "deis-router" | head -n 1 | \
138140
awk '{printf "%-10s (%s) \r", $$4, $$5}'; \
139141
sleep 8; \
@@ -144,7 +146,7 @@ start-warning:
144146
$(call echo_cyan,"Deis components may take a long time to start the first time they are initialized.")
145147

146148
status: check-fleet
147-
$(FLEETCTL) list-units
149+
$(FLEETCTL) $(list-units)
148150

149151
stop: check-fleet
150152
$(FLEETCTL) stop -block-attempts=600 $(strip $(call deis_units,launched,active))

0 commit comments

Comments
 (0)