rhc 1.15.6 → 1.16.9
Sign up to get free protection for your applications and to get access to all the features.
- data/autocomplete/rhc_bash +168 -24
- data/features/assets/deploy.tar.gz +0 -0
- data/features/core_feature.rb +6 -0
- data/features/deployments_feature.rb +127 -0
- data/features/keys_feature.rb +37 -0
- data/features/members_feature.rb +36 -1
- data/lib/rhc/commands/app.rb +79 -2
- data/lib/rhc/commands/deployment.rb +82 -0
- data/lib/rhc/commands/snapshot.rb +6 -1
- data/lib/rhc/commands/sshkey.rb +29 -14
- data/lib/rhc/commands/tail.rb +1 -1
- data/lib/rhc/deployment_helpers.rb +88 -0
- data/lib/rhc/exceptions.rb +24 -0
- data/lib/rhc/git_helpers.rb +1 -1
- data/lib/rhc/helpers.rb +17 -14
- data/lib/rhc/highline_extensions.rb +15 -15
- data/lib/rhc/output_helpers.rb +51 -9
- data/lib/rhc/rest.rb +1 -0
- data/lib/rhc/rest/activation.rb +11 -0
- data/lib/rhc/rest/application.rb +53 -1
- data/lib/rhc/rest/client.rb +16 -12
- data/lib/rhc/rest/deployment.rb +18 -0
- data/lib/rhc/rest/key.rb +14 -2
- data/lib/rhc/rest/mock.rb +90 -5
- data/lib/rhc/ssh_helpers.rb +82 -21
- data/lib/rhc/wizard.rb +2 -2
- data/spec/direct_execution_helper.rb +93 -26
- data/spec/rhc/commands/deployment_spec.rb +286 -0
- data/spec/rhc/commands/snapshot_spec.rb +12 -0
- data/spec/rhc/commands/sshkey_spec.rb +37 -0
- data/spec/rhc/commands/tail_spec.rb +2 -2
- data/spec/rhc/rest_client_spec.rb +6 -2
- data/spec/spec_helper.rb +1 -1
- metadata +17 -5
data/autocomplete/rhc_bash
CHANGED
@@ -10,9 +10,9 @@ _rhc()
|
|
10
10
|
if [[ "$cur" == -* ]]; then
|
11
11
|
opts="--always-prefix --clean --config --debug --insecure --limit --mock --noprompt --password --raw --rhlogin --server --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --token"
|
12
12
|
elif [ -z $cur ]; then
|
13
|
-
opts="account alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert app app-create app-delete app-force-stop app-reload app-restart app-show app-start app-stop app-tidy apps authorization authorization-add authorization-delete authorization-delete-all authorization-list cartridge cartridge-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage domain domain-configure domain-create domain-delete domain-leave domain-list domain-rename domain-show env env-list env-set env-show env-unset git-clone logout member member-add member-list member-remove port-forward server setup snapshot snapshot-restore snapshot-save ssh sshkey sshkey-add sshkey-list sshkey-remove sshkey-show tail threaddump"
|
13
|
+
opts="account alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert app app-configure app-create app-delete app-deploy app-force-stop app-reload app-restart app-show app-start app-stop app-tidy apps authorization authorization-add authorization-delete authorization-delete-all authorization-list cartridge cartridge-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage deployment-activate deployment-list deployment-show domain domain-configure domain-create domain-delete domain-leave domain-list domain-rename domain-show env env-list env-set env-show env-unset git-clone logout member member-add member-list member-remove port-forward server setup snapshot snapshot-restore snapshot-save ssh sshkey sshkey-add sshkey-list sshkey-remove sshkey-show tail threaddump"
|
14
14
|
else
|
15
|
-
opts="account account-logout add-alias add-authorization add-cartridge add-member add-sshkey alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert aliases app app-create app-delete app-env app-force-stop app-reload app-restart app-show app-snapshot app-ssh app-start app-stop app-tidy apps authorization authorization-add authorization-delete authorization-delete-all authorization-list authorizations cartridge cartridge-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage cartridges configure-domain create-app create-domain delete-all-authorization delete-app delete-authorization delete-cert-alias delete-domain domain domain-configure domain-create domain-delete domain-leave domain-list domain-rename domain-show domains env env-add env-list env-remove env-set env-show env-unset force-stop-app git-clone leave-domain list-alias list-authorization list-cartridge list-domain list-env list-member list-sshkey logout member member-add member-list member-remove members port-forward reload-app reload-cartridge remove-alias remove-cartridge remove-member remove-sshkey rename-domain restart-app restart-cartridge restore-snapshot save-snapshot scale-cartridge server set-env setup show-app show-cartridge show-domain show-env show-sshkey snapshot snapshot-restore snapshot-save ssh sshkey sshkey-add sshkey-list sshkey-remove sshkey-show start-app start-cartridge status-cartridge stop-app stop-cartridge storage-cartridge tail threaddump tidy-app unset-env update-cert-alias"
|
15
|
+
opts="account account-logout activate-deployment add-alias add-authorization add-cartridge add-member add-sshkey alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert aliases app app-configure app-create app-delete app-deploy app-env app-force-stop app-reload app-restart app-show app-snapshot app-ssh app-start app-stop app-tidy apps authorization authorization-add authorization-delete authorization-delete-all authorization-list authorizations cartridge cartridge-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage cartridges configure-app configure-domain create-app create-domain delete-all-authorization delete-app delete-authorization delete-cert-alias delete-domain deploy deploy-app deployment deployment-activate deployment-list deployment-show deployments domain domain-configure domain-create domain-delete domain-leave domain-list domain-rename domain-show domains env env-add env-list env-remove env-set env-show env-unset force-stop-app git-clone leave-domain list-alias list-authorization list-cartridge list-deployment list-domain list-env list-member list-sshkey logout member member-add member-list member-remove members port-forward reload-app reload-cartridge remove-alias remove-cartridge remove-member remove-sshkey rename-domain restart-app restart-cartridge restore-snapshot save-snapshot scale-cartridge server set-env setup show-app show-cartridge show-deployment show-domain show-env show-sshkey snapshot snapshot-restore snapshot-save ssh sshkey sshkey-add sshkey-list sshkey-remove sshkey-show start-app start-cartridge status-cartridge stop-app stop-cartridge storage-cartridge tail threaddump tidy-app unset-env update-cert-alias"
|
16
16
|
fi
|
17
17
|
else
|
18
18
|
prev="${COMP_WORDS[@]:0:COMP_CWORD}"
|
@@ -44,6 +44,14 @@ _rhc()
|
|
44
44
|
fi
|
45
45
|
;;
|
46
46
|
|
47
|
+
"rhc activate-deployment")
|
48
|
+
if [[ "$cur" == -* ]]; then
|
49
|
+
opts="--app --application-id --id --namespace"
|
50
|
+
else
|
51
|
+
opts=""
|
52
|
+
fi
|
53
|
+
;;
|
54
|
+
|
47
55
|
"rhc add-alias")
|
48
56
|
if [[ "$cur" == -* ]]; then
|
49
57
|
opts="--app --application-id --namespace"
|
@@ -184,13 +192,21 @@ _rhc()
|
|
184
192
|
if [[ "$cur" == -* ]]; then
|
185
193
|
opts=""
|
186
194
|
else
|
187
|
-
opts="
|
195
|
+
opts="create delete start stop force-stop restart reload tidy show deploy configure env snapshot"
|
196
|
+
fi
|
197
|
+
;;
|
198
|
+
|
199
|
+
"rhc app configure")
|
200
|
+
if [[ "$cur" == -* ]]; then
|
201
|
+
opts="--app --application-id --auto-deploy --deployment-branch --deployment-type --keep-deployments --namespace --no-auto-deploy"
|
202
|
+
else
|
203
|
+
opts=""
|
188
204
|
fi
|
189
205
|
;;
|
190
206
|
|
191
207
|
"rhc app create")
|
192
208
|
if [[ "$cur" == -* ]]; then
|
193
|
-
opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --repo --scaling --type"
|
209
|
+
opts="--app --auto-deploy --deployment-branch --dns --enable-jenkins --env --from-code --gear-size --git --keep-deployments --namespace --no-auto-deploy --no-dns --no-git --no-keys --repo --scaling --type"
|
194
210
|
else
|
195
211
|
opts=""
|
196
212
|
fi
|
@@ -204,6 +220,14 @@ _rhc()
|
|
204
220
|
fi
|
205
221
|
;;
|
206
222
|
|
223
|
+
"rhc app deploy")
|
224
|
+
if [[ "$cur" == -* ]]; then
|
225
|
+
opts="--app --application-id --force-clean-build --hot-deploy --namespace --no-force-clean-build --no-hot-deploy --ref"
|
226
|
+
else
|
227
|
+
opts=""
|
228
|
+
fi
|
229
|
+
;;
|
230
|
+
|
207
231
|
"rhc app env")
|
208
232
|
if [[ "$cur" == -* ]]; then
|
209
233
|
opts="--app --application-id --confirm --env --namespace"
|
@@ -238,7 +262,7 @@ _rhc()
|
|
238
262
|
|
239
263
|
"rhc app show")
|
240
264
|
if [[ "$cur" == -* ]]; then
|
241
|
-
opts="--app --application-id --gears --namespace --state"
|
265
|
+
opts="--app --application-id --configuration --gears --namespace --state"
|
242
266
|
else
|
243
267
|
opts=""
|
244
268
|
fi
|
@@ -246,7 +270,7 @@ _rhc()
|
|
246
270
|
|
247
271
|
"rhc app snapshot")
|
248
272
|
if [[ "$cur" == -* ]]; then
|
249
|
-
opts="--app --application-id --filepath --namespace"
|
273
|
+
opts="--app --application-id --deployment --filepath --namespace --ssh"
|
250
274
|
else
|
251
275
|
opts=""
|
252
276
|
fi
|
@@ -254,7 +278,7 @@ _rhc()
|
|
254
278
|
|
255
279
|
"rhc app ssh")
|
256
280
|
if [[ "$cur" == -* ]]; then
|
257
|
-
opts="--app --application-id --gears --limit --namespace --raw --ssh"
|
281
|
+
opts="--app --application-id --command --gears --limit --namespace --raw --ssh"
|
258
282
|
else
|
259
283
|
opts=""
|
260
284
|
fi
|
@@ -284,9 +308,17 @@ _rhc()
|
|
284
308
|
fi
|
285
309
|
;;
|
286
310
|
|
311
|
+
"rhc app-configure")
|
312
|
+
if [[ "$cur" == -* ]]; then
|
313
|
+
opts="--app --application-id --auto-deploy --deployment-branch --deployment-type --keep-deployments --namespace --no-auto-deploy"
|
314
|
+
else
|
315
|
+
opts=""
|
316
|
+
fi
|
317
|
+
;;
|
318
|
+
|
287
319
|
"rhc app-create")
|
288
320
|
if [[ "$cur" == -* ]]; then
|
289
|
-
opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --repo --scaling --type"
|
321
|
+
opts="--app --auto-deploy --deployment-branch --dns --enable-jenkins --env --from-code --gear-size --git --keep-deployments --namespace --no-auto-deploy --no-dns --no-git --no-keys --repo --scaling --type"
|
290
322
|
else
|
291
323
|
opts=""
|
292
324
|
fi
|
@@ -300,6 +332,14 @@ _rhc()
|
|
300
332
|
fi
|
301
333
|
;;
|
302
334
|
|
335
|
+
"rhc app-deploy")
|
336
|
+
if [[ "$cur" == -* ]]; then
|
337
|
+
opts="--app --application-id --force-clean-build --hot-deploy --namespace --no-force-clean-build --no-hot-deploy --ref"
|
338
|
+
else
|
339
|
+
opts=""
|
340
|
+
fi
|
341
|
+
;;
|
342
|
+
|
303
343
|
"rhc app-env")
|
304
344
|
if [[ "$cur" == -* ]]; then
|
305
345
|
opts="--app --application-id --confirm --env --namespace"
|
@@ -334,7 +374,7 @@ _rhc()
|
|
334
374
|
|
335
375
|
"rhc app-show")
|
336
376
|
if [[ "$cur" == -* ]]; then
|
337
|
-
opts="--app --application-id --gears --namespace --state"
|
377
|
+
opts="--app --application-id --configuration --gears --namespace --state"
|
338
378
|
else
|
339
379
|
opts=""
|
340
380
|
fi
|
@@ -342,7 +382,7 @@ _rhc()
|
|
342
382
|
|
343
383
|
"rhc app-snapshot")
|
344
384
|
if [[ "$cur" == -* ]]; then
|
345
|
-
opts="--app --application-id --filepath --namespace"
|
385
|
+
opts="--app --application-id --deployment --filepath --namespace --ssh"
|
346
386
|
else
|
347
387
|
opts=""
|
348
388
|
fi
|
@@ -350,7 +390,7 @@ _rhc()
|
|
350
390
|
|
351
391
|
"rhc app-ssh")
|
352
392
|
if [[ "$cur" == -* ]]; then
|
353
|
-
opts="--app --application-id --gears --limit --namespace --raw --ssh"
|
393
|
+
opts="--app --application-id --command --gears --limit --namespace --raw --ssh"
|
354
394
|
else
|
355
395
|
opts=""
|
356
396
|
fi
|
@@ -660,6 +700,14 @@ _rhc()
|
|
660
700
|
fi
|
661
701
|
;;
|
662
702
|
|
703
|
+
"rhc configure-app")
|
704
|
+
if [[ "$cur" == -* ]]; then
|
705
|
+
opts="--app --application-id --auto-deploy --deployment-branch --deployment-type --keep-deployments --namespace --no-auto-deploy"
|
706
|
+
else
|
707
|
+
opts=""
|
708
|
+
fi
|
709
|
+
;;
|
710
|
+
|
663
711
|
"rhc configure-domain")
|
664
712
|
if [[ "$cur" == -* ]]; then
|
665
713
|
opts="--allowed-gear-sizes --namespace --no-allowed-gear-sizes"
|
@@ -670,7 +718,7 @@ _rhc()
|
|
670
718
|
|
671
719
|
"rhc create-app")
|
672
720
|
if [[ "$cur" == -* ]]; then
|
673
|
-
opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --repo --scaling --type"
|
721
|
+
opts="--app --auto-deploy --deployment-branch --dns --enable-jenkins --env --from-code --gear-size --git --keep-deployments --namespace --no-auto-deploy --no-dns --no-git --no-keys --repo --scaling --type"
|
674
722
|
else
|
675
723
|
opts=""
|
676
724
|
fi
|
@@ -724,6 +772,86 @@ _rhc()
|
|
724
772
|
fi
|
725
773
|
;;
|
726
774
|
|
775
|
+
"rhc deploy")
|
776
|
+
if [[ "$cur" == -* ]]; then
|
777
|
+
opts="--app --application-id --force-clean-build --hot-deploy --namespace --no-force-clean-build --no-hot-deploy --ref"
|
778
|
+
else
|
779
|
+
opts=""
|
780
|
+
fi
|
781
|
+
;;
|
782
|
+
|
783
|
+
"rhc deploy-app")
|
784
|
+
if [[ "$cur" == -* ]]; then
|
785
|
+
opts="--app --application-id --force-clean-build --hot-deploy --namespace --no-force-clean-build --no-hot-deploy --ref"
|
786
|
+
else
|
787
|
+
opts=""
|
788
|
+
fi
|
789
|
+
;;
|
790
|
+
|
791
|
+
"rhc deployment")
|
792
|
+
if [[ "$cur" == -* ]]; then
|
793
|
+
opts=""
|
794
|
+
else
|
795
|
+
opts="list show activate"
|
796
|
+
fi
|
797
|
+
;;
|
798
|
+
|
799
|
+
"rhc deployment activate")
|
800
|
+
if [[ "$cur" == -* ]]; then
|
801
|
+
opts="--app --application-id --id --namespace"
|
802
|
+
else
|
803
|
+
opts=""
|
804
|
+
fi
|
805
|
+
;;
|
806
|
+
|
807
|
+
"rhc deployment list")
|
808
|
+
if [[ "$cur" == -* ]]; then
|
809
|
+
opts="--app --application-id --namespace"
|
810
|
+
else
|
811
|
+
opts=""
|
812
|
+
fi
|
813
|
+
;;
|
814
|
+
|
815
|
+
"rhc deployment show")
|
816
|
+
if [[ "$cur" == -* ]]; then
|
817
|
+
opts="--app --application-id --id --namespace"
|
818
|
+
else
|
819
|
+
opts=""
|
820
|
+
fi
|
821
|
+
;;
|
822
|
+
|
823
|
+
"rhc deployment-activate")
|
824
|
+
if [[ "$cur" == -* ]]; then
|
825
|
+
opts="--app --application-id --id --namespace"
|
826
|
+
else
|
827
|
+
opts=""
|
828
|
+
fi
|
829
|
+
;;
|
830
|
+
|
831
|
+
"rhc deployment-list")
|
832
|
+
if [[ "$cur" == -* ]]; then
|
833
|
+
opts="--app --application-id --namespace"
|
834
|
+
else
|
835
|
+
opts=""
|
836
|
+
fi
|
837
|
+
;;
|
838
|
+
|
839
|
+
"rhc deployment-show")
|
840
|
+
if [[ "$cur" == -* ]]; then
|
841
|
+
opts="--app --application-id --id --namespace"
|
842
|
+
else
|
843
|
+
opts=""
|
844
|
+
fi
|
845
|
+
;;
|
846
|
+
|
847
|
+
"rhc deployments")
|
848
|
+
if [[ "$cur" == -* ]]; then
|
849
|
+
opts="--app --application-id --namespace"
|
850
|
+
else
|
851
|
+
opts=""
|
852
|
+
fi
|
853
|
+
;;
|
854
|
+
|
727
855
|
"rhc domain")
|
728
856
|
if [[ "$cur" == -* ]]; then
|
729
857
|
opts=""
|
@@ -766,7 +894,7 @@ _rhc()
|
|
766
894
|
|
767
895
|
"rhc domain list")
|
768
896
|
if [[ "$cur" == -* ]]; then
|
769
|
-
opts="--mine"
|
897
|
+
opts="--ids --mine"
|
770
898
|
else
|
771
899
|
opts=""
|
772
900
|
fi
|
@@ -822,7 +950,7 @@ _rhc()
|
|
822
950
|
|
823
951
|
"rhc domain-list")
|
824
952
|
if [[ "$cur" == -* ]]; then
|
825
|
-
opts="--mine"
|
953
|
+
opts="--ids --mine"
|
826
954
|
else
|
827
955
|
opts=""
|
828
956
|
fi
|
@@ -846,7 +974,7 @@ _rhc()
|
|
846
974
|
|
847
975
|
"rhc domains")
|
848
976
|
if [[ "$cur" == -* ]]; then
|
849
|
-
opts="--mine"
|
977
|
+
opts="--ids --mine"
|
850
978
|
else
|
851
979
|
opts=""
|
852
980
|
fi
|
@@ -1004,9 +1132,17 @@ _rhc()
|
|
1004
1132
|
fi
|
1005
1133
|
;;
|
1006
1134
|
|
1135
|
+
"rhc list-deployment")
|
1136
|
+
if [[ "$cur" == -* ]]; then
|
1137
|
+
opts="--app --application-id --namespace"
|
1138
|
+
else
|
1139
|
+
opts=""
|
1140
|
+
fi
|
1141
|
+
;;
|
1142
|
+
|
1007
1143
|
"rhc list-domain")
|
1008
1144
|
if [[ "$cur" == -* ]]; then
|
1009
|
-
opts="--mine"
|
1145
|
+
opts="--ids --mine"
|
1010
1146
|
else
|
1011
1147
|
opts=""
|
1012
1148
|
fi
|
@@ -1190,7 +1326,7 @@ _rhc()
|
|
1190
1326
|
|
1191
1327
|
"rhc restore-snapshot")
|
1192
1328
|
if [[ "$cur" == -* ]]; then
|
1193
|
-
opts="--app --application-id --filepath --namespace"
|
1329
|
+
opts="--app --application-id --filepath --namespace --ssh"
|
1194
1330
|
else
|
1195
1331
|
opts=""
|
1196
1332
|
fi
|
@@ -1198,7 +1334,7 @@ _rhc()
|
|
1198
1334
|
|
1199
1335
|
"rhc save-snapshot")
|
1200
1336
|
if [[ "$cur" == -* ]]; then
|
1201
|
-
opts="--app --application-id --filepath --namespace"
|
1337
|
+
opts="--app --application-id --deployment --filepath --namespace --ssh"
|
1202
1338
|
else
|
1203
1339
|
opts=""
|
1204
1340
|
fi
|
@@ -1238,7 +1374,7 @@ _rhc()
|
|
1238
1374
|
|
1239
1375
|
"rhc show-app")
|
1240
1376
|
if [[ "$cur" == -* ]]; then
|
1241
|
-
opts="--app --application-id --gears --namespace --state"
|
1377
|
+
opts="--app --application-id --configuration --gears --namespace --state"
|
1242
1378
|
else
|
1243
1379
|
opts=""
|
1244
1380
|
fi
|
@@ -1252,6 +1388,14 @@ _rhc()
|
|
1252
1388
|
fi
|
1253
1389
|
;;
|
1254
1390
|
|
1391
|
+
"rhc show-deployment")
|
1392
|
+
if [[ "$cur" == -* ]]; then
|
1393
|
+
opts="--app --application-id --id --namespace"
|
1394
|
+
else
|
1395
|
+
opts=""
|
1396
|
+
fi
|
1397
|
+
;;
|
1398
|
+
|
1255
1399
|
"rhc show-domain")
|
1256
1400
|
if [[ "$cur" == -* ]]; then
|
1257
1401
|
opts="--namespace"
|
@@ -1286,7 +1430,7 @@ _rhc()
|
|
1286
1430
|
|
1287
1431
|
"rhc snapshot restore")
|
1288
1432
|
if [[ "$cur" == -* ]]; then
|
1289
|
-
opts="--app --application-id --filepath --namespace"
|
1433
|
+
opts="--app --application-id --filepath --namespace --ssh"
|
1290
1434
|
else
|
1291
1435
|
opts=""
|
1292
1436
|
fi
|
@@ -1294,7 +1438,7 @@ _rhc()
|
|
1294
1438
|
|
1295
1439
|
"rhc snapshot save")
|
1296
1440
|
if [[ "$cur" == -* ]]; then
|
1297
|
-
opts="--app --application-id --filepath --namespace"
|
1441
|
+
opts="--app --application-id --deployment --filepath --namespace --ssh"
|
1298
1442
|
else
|
1299
1443
|
opts=""
|
1300
1444
|
fi
|
@@ -1302,7 +1446,7 @@ _rhc()
|
|
1302
1446
|
|
1303
1447
|
"rhc snapshot-restore")
|
1304
1448
|
if [[ "$cur" == -* ]]; then
|
1305
|
-
opts="--app --application-id --filepath --namespace"
|
1449
|
+
opts="--app --application-id --filepath --namespace --ssh"
|
1306
1450
|
else
|
1307
1451
|
opts=""
|
1308
1452
|
fi
|
@@ -1310,7 +1454,7 @@ _rhc()
|
|
1310
1454
|
|
1311
1455
|
"rhc snapshot-save")
|
1312
1456
|
if [[ "$cur" == -* ]]; then
|
1313
|
-
opts="--app --application-id --filepath --namespace"
|
1457
|
+
opts="--app --application-id --deployment --filepath --namespace --ssh"
|
1314
1458
|
else
|
1315
1459
|
opts=""
|
1316
1460
|
fi
|
@@ -1318,7 +1462,7 @@ _rhc()
|
|
1318
1462
|
|
1319
1463
|
"rhc ssh")
|
1320
1464
|
if [[ "$cur" == -* ]]; then
|
1321
|
-
opts="--app --application-id --gears --limit --namespace --raw --ssh"
|
1465
|
+
opts="--app --application-id --command --gears --limit --namespace --raw --ssh"
|
1322
1466
|
else
|
1323
1467
|
opts=""
|
1324
1468
|
fi
|
Binary file
|
data/features/core_feature.rb
CHANGED
@@ -68,6 +68,12 @@ describe "rhc core scenarios" do
|
|
68
68
|
|
69
69
|
let(:app){ @app }
|
70
70
|
|
71
|
+
it "should display domain list" do
|
72
|
+
r = rhc 'domains'
|
73
|
+
r.status.should == 0
|
74
|
+
r.stdout.should match "Domain #{app.domain_id}"
|
75
|
+
end
|
76
|
+
|
71
77
|
it "should show app state" do
|
72
78
|
r = rhc 'app-show', app.name, '--state'
|
73
79
|
r.status.should == 0
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'direct_execution_helper'
|
3
|
+
require 'httpclient'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
DEPLOYMENT_LIST_ITEM = /([0-2]?[0-9]:[0-5][0-9] (AM|PM), deployment [a-f0-9]{8})/
|
7
|
+
|
8
|
+
describe "rhc deployment scenarios" do
|
9
|
+
context "with an existing app" do
|
10
|
+
before(:all) do
|
11
|
+
standard_config
|
12
|
+
@app = has_an_application
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:app){ @app }
|
16
|
+
|
17
|
+
it "should display deployment list" do
|
18
|
+
r = list_deployments
|
19
|
+
r.stdout.should match DEPLOYMENT_LIST_ITEM
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should configure the app for a git ref deployment" do
|
23
|
+
r = configure_app_for_manual_git_deployment
|
24
|
+
r.stdout.should match /Deployment:\s+manual/
|
25
|
+
r.stdout.should match /Keep Deployments:\s+10/
|
26
|
+
r.stdout.should match /Deployment Type:\s+git/
|
27
|
+
r.stdout.should match /Deployment Branch:\s+master/
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should configure the app for a binary deployment" do
|
31
|
+
r = configure_app_for_manual_binary_deployment
|
32
|
+
r.stdout.should match /Deployment:\s+manual/
|
33
|
+
r.stdout.should match /Keep Deployments:\s+10/
|
34
|
+
r.stdout.should match /Deployment Type:\s+binary/
|
35
|
+
r.stdout.should match /Deployment Branch:\s+master/
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should deploy a git ref" do
|
39
|
+
configure_app_for_manual_git_deployment
|
40
|
+
r = deploy_master
|
41
|
+
r.stdout.should match /Deployment of git ref 'master' in progress for application #{app.name}/
|
42
|
+
r.stdout.should match /Success/
|
43
|
+
r = list_deployments
|
44
|
+
r.stdout.should match DEPLOYMENT_LIST_ITEM
|
45
|
+
r.stdout.scan(DEPLOYMENT_LIST_ITEM).length.should > 1
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should perform a complete deploy workflow" do
|
49
|
+
configure_app_for_manual_git_deployment
|
50
|
+
edit_simple_change 'Welcome to Test'
|
51
|
+
app_page_content.should match /Welcome to OpenShift/
|
52
|
+
app_page_content.should_not match /Welcome to Test/
|
53
|
+
deploy_master
|
54
|
+
app_page_content.should match /Welcome to Test/
|
55
|
+
app_page_content.should_not match /Welcome to OpenShift/
|
56
|
+
deployment_id = find_inactive_deployment
|
57
|
+
deployment_id.should_not be_nil
|
58
|
+
activate deployment_id
|
59
|
+
app_page_content.should match /Welcome to OpenShift/
|
60
|
+
app_page_content.should_not match /Welcome to Test/
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
def configure_app_for_manual_git_deployment
|
65
|
+
ensure_command 'configure-app', app.name, '--no-auto-deploy', '--keep-deployments', 10, '--deployment-type', 'git'
|
66
|
+
end
|
67
|
+
|
68
|
+
def configure_app_for_manual_binary_deployment
|
69
|
+
ensure_command 'configure-app', app.name, '--no-auto-deploy', '--keep-deployments', 10, '--deployment-type', 'binary'
|
70
|
+
end
|
71
|
+
|
72
|
+
def list_deployments
|
73
|
+
ensure_command 'deployments', app.name
|
74
|
+
end
|
75
|
+
|
76
|
+
def deploy(ref)
|
77
|
+
ensure_command 'deploy', ref, '-a', app.name
|
78
|
+
end
|
79
|
+
|
80
|
+
def deploy_master
|
81
|
+
deploy 'master'
|
82
|
+
end
|
83
|
+
|
84
|
+
def activate(deployment_id)
|
85
|
+
ensure_command 'activate-deployment', deployment_id, '-a', app.name
|
86
|
+
end
|
87
|
+
|
88
|
+
def snapshot_deployment
|
89
|
+
ensure_command 'save-snapshot', app.name, '--deployment'
|
90
|
+
end
|
91
|
+
|
92
|
+
def git_clone
|
93
|
+
ensure_command 'git-clone', app.name, '-r', git_directory
|
94
|
+
Dir.exists?(git_directory).should be_true
|
95
|
+
end
|
96
|
+
|
97
|
+
def edit_simple_change(content)
|
98
|
+
FileUtils.rm_rf git_directory
|
99
|
+
git_clone
|
100
|
+
Dir.chdir git_directory
|
101
|
+
`sed -i "s/Welcome to OpenShift/#{content}/" php/index.php`
|
102
|
+
`git commit -a -m "Commit from Feature Tests"`
|
103
|
+
`git push origin master`
|
104
|
+
Dir.chdir '../'
|
105
|
+
FileUtils.rm_rf git_directory
|
106
|
+
end
|
107
|
+
|
108
|
+
def app_page_content
|
109
|
+
HTTPClient.new.get_content(app.app_url)
|
110
|
+
end
|
111
|
+
|
112
|
+
def git_directory
|
113
|
+
"#{app.name}_feature_tests_repo"
|
114
|
+
end
|
115
|
+
|
116
|
+
def find_inactive_deployment
|
117
|
+
r = list_deployments
|
118
|
+
r.stdout.match(/deployment ([a-f0-9]{8})/)[1]
|
119
|
+
end
|
120
|
+
|
121
|
+
def ensure_command(*args)
|
122
|
+
r = rhc *args
|
123
|
+
r.status.should == 0
|
124
|
+
r
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|