rhc 1.12.4 → 1.13.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-create domain-delete domain-list domain-show domain-update git-clone logout 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-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-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage domain domain-create domain-delete domain-list domain-show domain-update env env-list env-set env-show env-unset git-clone logout 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-sshkey alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert aliases app app-create app-delete 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 create-app create-domain delete-all-authorization delete-app delete-authorization delete-cert-alias delete-domain domain domain-create domain-delete domain-list domain-show domain-update domains force-stop-app git-clone list-alias list-authorization list-cartridge list-domain list-sshkey logout port-forward reload-app reload-cartridge remove-alias remove-cartridge remove-sshkey restart-app restart-cartridge restore-snapshot save-snapshot scale-cartridge server setup show-app show-cartridge show-domain 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 update-cert-alias update-domain"
15
+ opts="account account-logout add-alias add-authorization add-cartridge 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 create-app create-domain delete-all-authorization delete-app delete-authorization delete-cert-alias delete-domain domain domain-create domain-delete domain-list domain-show domain-update domains env env-add env-list env-remove env-set env-show env-unset force-stop-app git-clone list-alias list-authorization list-cartridge list-domain list-env list-sshkey logout port-forward reload-app reload-cartridge remove-alias remove-cartridge remove-sshkey 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 update-domain"
16
16
  fi
17
17
  else
18
18
  prev="${COMP_WORDS[@]:0:COMP_CWORD}"
@@ -62,7 +62,7 @@ _rhc()
62
62
 
63
63
  "rhc add-cartridge")
64
64
  if [[ "$cur" == -* ]]; then
65
- opts="--app --cartridge --namespace"
65
+ opts="--app --cartridge --env --namespace"
66
66
  else
67
67
  opts=""
68
68
  fi
@@ -176,13 +176,13 @@ _rhc()
176
176
  if [[ "$cur" == -* ]]; then
177
177
  opts=""
178
178
  else
179
- opts="snapshot create delete start stop force-stop restart reload tidy show"
179
+ opts="snapshot env create delete start stop force-stop restart reload tidy show"
180
180
  fi
181
181
  ;;
182
182
 
183
183
  "rhc app create")
184
184
  if [[ "$cur" == -* ]]; then
185
- opts="--app --dns --enable-jenkins --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
185
+ opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
186
186
  else
187
187
  opts=""
188
188
  fi
@@ -196,6 +196,14 @@ _rhc()
196
196
  fi
197
197
  ;;
198
198
 
199
+ "rhc app env")
200
+ if [[ "$cur" == -* ]]; then
201
+ opts="--app --confirm --env --namespace"
202
+ else
203
+ opts=""
204
+ fi
205
+ ;;
206
+
199
207
  "rhc app force-stop")
200
208
  if [[ "$cur" == -* ]]; then
201
209
  opts="--app --namespace"
@@ -270,7 +278,7 @@ _rhc()
270
278
 
271
279
  "rhc app-create")
272
280
  if [[ "$cur" == -* ]]; then
273
- opts="--app --dns --enable-jenkins --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
281
+ opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
274
282
  else
275
283
  opts=""
276
284
  fi
@@ -284,6 +292,14 @@ _rhc()
284
292
  fi
285
293
  ;;
286
294
 
295
+ "rhc app-env")
296
+ if [[ "$cur" == -* ]]; then
297
+ opts="--app --confirm --env --namespace"
298
+ else
299
+ opts=""
300
+ fi
301
+ ;;
302
+
287
303
  "rhc app-force-stop")
288
304
  if [[ "$cur" == -* ]]; then
289
305
  opts="--app --namespace"
@@ -454,7 +470,7 @@ _rhc()
454
470
 
455
471
  "rhc cartridge add")
456
472
  if [[ "$cur" == -* ]]; then
457
- opts="--app --cartridge --namespace"
473
+ opts="--app --cartridge --env --namespace"
458
474
  else
459
475
  opts=""
460
476
  fi
@@ -542,7 +558,7 @@ _rhc()
542
558
 
543
559
  "rhc cartridge-add")
544
560
  if [[ "$cur" == -* ]]; then
545
- opts="--app --cartridge --namespace"
561
+ opts="--app --cartridge --env --namespace"
546
562
  else
547
563
  opts=""
548
564
  fi
@@ -638,7 +654,7 @@ _rhc()
638
654
 
639
655
  "rhc create-app")
640
656
  if [[ "$cur" == -* ]]; then
641
- opts="--app --dns --enable-jenkins --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
657
+ opts="--app --dns --enable-jenkins --env --from-code --gear-size --git --namespace --no-dns --no-git --no-keys --nogit --repo --scaling --type"
642
658
  else
643
659
  opts=""
644
660
  fi
@@ -788,6 +804,110 @@ _rhc()
788
804
  fi
789
805
  ;;
790
806
 
807
+ "rhc env")
808
+ if [[ "$cur" == -* ]]; then
809
+ opts=""
810
+ else
811
+ opts="add set remove unset list show"
812
+ fi
813
+ ;;
814
+
815
+ "rhc env add")
816
+ if [[ "$cur" == -* ]]; then
817
+ opts="--app --confirm --env --namespace"
818
+ else
819
+ opts=""
820
+ fi
821
+ ;;
822
+
823
+ "rhc env list")
824
+ if [[ "$cur" == -* ]]; then
825
+ opts="--app --namespace --quotes --table"
826
+ else
827
+ opts=""
828
+ fi
829
+ ;;
830
+
831
+ "rhc env remove")
832
+ if [[ "$cur" == -* ]]; then
833
+ opts="--app --confirm --env --namespace"
834
+ else
835
+ opts=""
836
+ fi
837
+ ;;
838
+
839
+ "rhc env set")
840
+ if [[ "$cur" == -* ]]; then
841
+ opts="--app --confirm --env --namespace"
842
+ else
843
+ opts=""
844
+ fi
845
+ ;;
846
+
847
+ "rhc env show")
848
+ if [[ "$cur" == -* ]]; then
849
+ opts="--app --env --namespace --quotes --table"
850
+ else
851
+ opts=""
852
+ fi
853
+ ;;
854
+
855
+ "rhc env unset")
856
+ if [[ "$cur" == -* ]]; then
857
+ opts="--app --confirm --env --namespace"
858
+ else
859
+ opts=""
860
+ fi
861
+ ;;
862
+
863
+ "rhc env-add")
864
+ if [[ "$cur" == -* ]]; then
865
+ opts="--app --confirm --env --namespace"
866
+ else
867
+ opts=""
868
+ fi
869
+ ;;
870
+
871
+ "rhc env-list")
872
+ if [[ "$cur" == -* ]]; then
873
+ opts="--app --namespace --quotes --table"
874
+ else
875
+ opts=""
876
+ fi
877
+ ;;
878
+
879
+ "rhc env-remove")
880
+ if [[ "$cur" == -* ]]; then
881
+ opts="--app --confirm --env --namespace"
882
+ else
883
+ opts=""
884
+ fi
885
+ ;;
886
+
887
+ "rhc env-set")
888
+ if [[ "$cur" == -* ]]; then
889
+ opts="--app --confirm --env --namespace"
890
+ else
891
+ opts=""
892
+ fi
893
+ ;;
894
+
895
+ "rhc env-show")
896
+ if [[ "$cur" == -* ]]; then
897
+ opts="--app --env --namespace --quotes --table"
898
+ else
899
+ opts=""
900
+ fi
901
+ ;;
902
+
903
+ "rhc env-unset")
904
+ if [[ "$cur" == -* ]]; then
905
+ opts="--app --confirm --env --namespace"
906
+ else
907
+ opts=""
908
+ fi
909
+ ;;
910
+
791
911
  "rhc force-stop-app")
792
912
  if [[ "$cur" == -* ]]; then
793
913
  opts="--app --namespace"
@@ -836,6 +956,14 @@ _rhc()
836
956
  fi
837
957
  ;;
838
958
 
959
+ "rhc list-env")
960
+ if [[ "$cur" == -* ]]; then
961
+ opts="--app --namespace --quotes --table"
962
+ else
963
+ opts=""
964
+ fi
965
+ ;;
966
+
839
967
  "rhc list-sshkey")
840
968
  if [[ "$cur" == -* ]]; then
841
969
  opts=""
@@ -948,6 +1076,14 @@ _rhc()
948
1076
  fi
949
1077
  ;;
950
1078
 
1079
+ "rhc set-env")
1080
+ if [[ "$cur" == -* ]]; then
1081
+ opts="--app --confirm --env --namespace"
1082
+ else
1083
+ opts=""
1084
+ fi
1085
+ ;;
1086
+
951
1087
  "rhc setup")
952
1088
  if [[ "$cur" == -* ]]; then
953
1089
  opts="--autocomplete --clean --create-token --no-create-token --server"
@@ -980,6 +1116,14 @@ _rhc()
980
1116
  fi
981
1117
  ;;
982
1118
 
1119
+ "rhc show-env")
1120
+ if [[ "$cur" == -* ]]; then
1121
+ opts="--app --env --namespace --quotes --table"
1122
+ else
1123
+ opts=""
1124
+ fi
1125
+ ;;
1126
+
983
1127
  "rhc show-sshkey")
984
1128
  if [[ "$cur" == -* ]]; then
985
1129
  opts=""
@@ -1180,6 +1324,14 @@ _rhc()
1180
1324
  fi
1181
1325
  ;;
1182
1326
 
1327
+ "rhc unset-env")
1328
+ if [[ "$cur" == -* ]]; then
1329
+ opts="--app --confirm --env --namespace"
1330
+ else
1331
+ opts=""
1332
+ fi
1333
+ ;;
1334
+
1183
1335
  "rhc update-cert-alias")
1184
1336
  if [[ "$cur" == -* ]]; then
1185
1337
  opts="--app --certificate --namespace --passphrase --private-key"
data/bin/rhc CHANGED
@@ -5,7 +5,7 @@ def get_args
5
5
  ARGV.shift
6
6
  args = ""
7
7
  ARGV.each do|a|
8
- if ( a.to_s.strip.length == 0 || a.to_s.strip.match(/\s/) ); a = "'#{a}'" end
8
+ if ( a.to_s.strip.length == 0 || a.to_s.strip.match(/\s/) ); a = "'#{a}'" end
9
9
  args += " #{a}"
10
10
  end
11
11
  args
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  begin
15
15
  Signal.trap("PIPE", "EXIT") if Signal.list["PIPE"]
16
-
16
+
17
17
  retcode = begin
18
18
  require 'rhc/cli'
19
19
  RHC::CLI.set_terminal
File without changes
@@ -0,0 +1 @@
1
+ include RHCHelper
@@ -2,7 +2,7 @@ if $target_os == 'fedora-18'
2
2
  CARTRIDGE_MAP = {
3
3
  "php" => { type: "php-5.4", name: "PHP 5.4" },
4
4
  "mysql" => { type: "mysql-5.1", name: "MySQL Database 5.1" },
5
- "phpmyadmin" => { type: "phpmyadmin-3.5", name: "phpMyAdmin 3.5" },
5
+ "phpmyadmin" => { type: "phpmyadmin-3", name: "phpMyAdmin 3" },
6
6
  "mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
7
7
  "postgresql" => { type: "postgresql-9.2", name: "PostgreSQL Database 9.2" },
8
8
  "cron" => { type: "cron-1.4", name: "Cron 1.4" },
@@ -12,7 +12,7 @@ elsif $target_os == 'fedora-19'
12
12
  CARTRIDGE_MAP = {
13
13
  "php" => { type: "php-5.5", name: "PHP 5.5" },
14
14
  "mysql" => { type: "mariadb-5.5", name: "MariaDB 5.5" },
15
- "phpmyadmin" => { type: "phpmyadmin-3.5", name: "phpMyAdmin 3.5" },
15
+ "phpmyadmin" => { type: "phpmyadmin-3", name: "phpMyAdmin 3" },
16
16
  "mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
17
17
  "postgresql" => { type: "postgresql-9.2", name: "PostgreSQL Database 9.2" },
18
18
  "cron" => { type: "cron-1.4", name: "Cron 1.4" },
@@ -22,11 +22,11 @@ else
22
22
  CARTRIDGE_MAP = {
23
23
  "php" => { type: "php-5.3", name: "PHP 5.3" },
24
24
  "mysql" => { type: "mysql-5.1", name: "MySQL Database 5.1" },
25
- "phpmyadmin" => { type: "phpmyadmin-3.4", name: "phpMyAdmin 3.4" },
25
+ "phpmyadmin" => { type: "phpmyadmin-3", name: "phpMyAdmin 3" },
26
26
  "mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
27
- "postgresql" => { type: "postgresql-8.4", name: "PostgreSQL Database 8.4" },
27
+ "postgresql" => { type: "postgresql-8.4", name: "PostgreSQL Database 8.4" },
28
28
  "cron" => { type: "cron-1.4", name: "Cron 1.4" },
29
- "haproxy" => { type: "haproxy-1.4", name: "" }
29
+ "haproxy" => { type: "haproxy-1.4", name: "" }
30
30
  }
31
31
  end
32
32
 
@@ -46,8 +46,8 @@ module RHC
46
46
  def match_cart(cart, search)
47
47
  search = search.to_s.downcase.gsub(/[_\-\s]/,' ')
48
48
  [
49
- cart.name,
50
- cart.description,
49
+ cart.name,
50
+ cart.description,
51
51
  (cart.tags || []).join(' '),
52
52
  ].compact.any?{ |s| s.present? && s.downcase.gsub(/[_\-\s]/,' ').include?(search) }
53
53
  end
@@ -83,9 +83,11 @@ module RHC
83
83
  def standalone_cartridges
84
84
  @standalone_cartridges ||= all_cartridges.select{ |c| c.type == 'standalone' }
85
85
  end
86
+
86
87
  def not_standalone_cartridges
87
88
  @not_standalone_cartridges ||= all_cartridges.select{ |c| c.type != 'standalone' }
88
89
  end
90
+
89
91
  def all_cartridges
90
92
  @all_cartridges = rest_client.cartridges
91
93
  end
@@ -95,6 +97,20 @@ module RHC
95
97
  carts.unshift ['==========', '=========']
96
98
  carts.unshift ['Short Name', 'Full name']
97
99
  say table(carts)
98
- end
100
+ end
101
+
102
+ def filter_jenkins_cartridges(tag)
103
+ cartridges = all_cartridges.select { |c| (c.tags || []).include?(tag) && c.name =~ /\Ajenkins/i }.sort
104
+ raise RHC::JenkinsNotInstalledOnServer if cartridges.empty?
105
+ cartridges
106
+ end
107
+
108
+ def jenkins_cartridges
109
+ @jenkins_cartridges ||= filter_jenkins_cartridges('ci')
110
+ end
111
+
112
+ def jenkins_client_cartridges
113
+ @jenkins_client_cartridges ||= filter_jenkins_cartridges('ci_builder')
114
+ end
99
115
  end
100
116
  end
@@ -149,7 +149,7 @@ module RHC
149
149
 
150
150
  unless matches
151
151
  RHC::Helpers.error "The command '#{program :name} #{provided_arguments.join(' ')}' is not recognized.\n"
152
- say "See '#{program :name} help' for a list of valid commands."
152
+ say "See '#{program :name} help' for a list of valid commands."
153
153
  return 1
154
154
  end
155
155
 
@@ -7,9 +7,9 @@ module RHC::Commands
7
7
  class App < Base
8
8
  summary "Commands for creating and managing applications"
9
9
  description <<-DESC
10
- Creates and controls an OpenShift application. To see the list of all
11
- applications use the rhc domain show command. Note that delete is not
12
- reversible and will stop your application and then remove the application
10
+ Creates and controls an OpenShift application. To see the list of all
11
+ applications use the rhc domain show command. Note that delete is not
12
+ reversible and will stop your application and then remove the application
13
13
  and repo from the remote server. No local changes are made.
14
14
  DESC
15
15
  syntax "<action>"
@@ -25,7 +25,7 @@ module RHC::Commands
25
25
 
26
26
  You can see a list of all valid cartridge types by running
27
27
  'rhc cartridge list'. OpenShift also supports downloading cartridges -
28
- pass a URL in place of the cartridge name and we'll download
28
+ pass a URL in place of the cartridge name and we'll download
29
29
  and install that cartridge into your app. Keep in mind that
30
30
  these cartridges receive no security updates. Note that not
31
31
  all OpenShift servers allow downloaded cartridges.
@@ -52,6 +52,7 @@ module RHC::Commands
52
52
  option ["-g", "--gear-size SIZE"], "Gear size controls how much memory and CPU your cartridges can use."
53
53
  option ["-s", "--scaling"], "Enable scaling for the web cartridge."
54
54
  option ["-r", "--repo DIR"], "Path to the Git repository (defaults to ./$app_name)"
55
+ option ["-e", "--env VARIABLE=VALUE"], "Environment variable(s) to be set on this app, or path to a file containing environment variables", :option_type => :list
55
56
  option ["--from-code URL"], "URL to a Git repository that will become the initial contents of the application"
56
57
  option ["--[no-]git"], "Skip creating the local Git repository."
57
58
  option ["--nogit"], "DEPRECATED: Skip creating the local Git repository.", :deprecated => {:key => :git, :value => false}
@@ -81,6 +82,8 @@ module RHC::Commands
81
82
  c.usage_rate? ? "#{c.short_name} (addtl. costs may apply)" : c.short_name
82
83
  end.join(', ')
83
84
 
85
+ environment_variables = collect_env_vars(options.env)
86
+
84
87
  paragraph do
85
88
  header "Application Options"
86
89
  table([["Namespace:", options.namespace],
@@ -88,6 +91,7 @@ module RHC::Commands
88
91
  (["Source Code:", options.from_code] if options.from_code),
89
92
  ["Gear Size:", options.gear_size || "default"],
90
93
  ["Scaling:", options.scaling ? "yes" : "no"],
94
+ (["Environment Variables:", environment_variables.map{|item| "#{item.name}=#{item.value}"}.join(', ')] if environment_variables.present?),
91
95
  ].compact
92
96
  ).each { |s| say " #{s}" }
93
97
  end
@@ -96,7 +100,7 @@ module RHC::Commands
96
100
  say "Creating application '#{name}' ... "
97
101
 
98
102
  # create the main app
99
- rest_app = create_app(name, cartridges, rest_domain, options.gear_size, options.scaling, options.from_code)
103
+ rest_app = create_app(name, cartridges, rest_domain, options.gear_size, options.scaling, options.from_code, environment_variables)
100
104
  success "done"
101
105
 
102
106
  paragraph{ indent{ success rest_app.messages.map(&:strip) } }
@@ -105,6 +109,7 @@ module RHC::Commands
105
109
  build_app_exists = rest_app.building_app
106
110
 
107
111
  if enable_jenkins?
112
+
108
113
  unless build_app_exists
109
114
  paragraph do
110
115
  say "Setting up a Jenkins application ... "
@@ -168,7 +173,7 @@ module RHC::Commands
168
173
  end
169
174
 
170
175
  output_issues(rest_app) if issues?
171
-
176
+
172
177
  paragraph do
173
178
  say "Your application '#{rest_app.name}' is now available."
174
179
  paragraph do
@@ -177,7 +182,8 @@ module RHC::Commands
177
182
  ['URL:', rest_app.app_url],
178
183
  ['SSH to:', rest_app.ssh_string],
179
184
  ['Git remote:', rest_app.git_url],
180
- (['Cloned to:', repo_dir] if repo_dir)
185
+ (['Cloned to:', repo_dir] if repo_dir),
186
+ (['Environment variables:', environment_variables.map{|item| "#{item.name}=#{item.value}"}.sort.join(', ')] if environment_variables.present?)
181
187
  ].compact
182
188
  end
183
189
  end
@@ -280,10 +286,10 @@ module RHC::Commands
280
286
  summary "Show information about an application"
281
287
  description <<-DESC
282
288
  Display the properties of an application, including its URL, the SSH
283
- connection string, and the Git remote URL. Will also display any
289
+ connection string, and the Git remote URL. Will also display any
284
290
  cartridges, their scale, and any values they expose.
285
291
 
286
- The '--state' option will retrieve information from each cartridge in
292
+ The '--state' option will retrieve information from each cartridge in
287
293
  the application, which may include cartridge specific text.
288
294
 
289
295
  To see information about the individual gears within an application,
@@ -292,7 +298,7 @@ module RHC::Commands
292
298
  storage on each gear.
293
299
 
294
300
  If you want to run commands against individual gears, use:
295
-
301
+
296
302
  rhc ssh <app> --gears '<command>'
297
303
 
298
304
  to run and display the output from each gear.
@@ -315,12 +321,12 @@ module RHC::Commands
315
321
  case options.gears
316
322
  when 'quota'
317
323
  opts = {:as => :gear, :split_cells_on => /\s*\t/, :header => ['Gear', 'Cartridges', 'Used', 'Limit'], :align => [nil, nil, :right, :right]}
318
- table_from_gears('echo "$(du -s 2>/dev/null | cut -f 1)"', groups, opts) do |gear, data, group|
324
+ table_from_gears('echo "$(du --block-size=1 -s 2>/dev/null | cut -f 1)"', groups, opts) do |gear, data, group|
319
325
  [gear['id'], group.cartridges.collect{ |c| c['name'] }.join(' '), (human_size(data.chomp) rescue 'error'), human_size(group.quota)]
320
326
  end
321
327
  when 'ssh'
322
328
  groups.each{ |group| group.gears.each{ |g| say (ssh_string(g['ssh_url']) or raise NoPerGearOperations) } }
323
- else
329
+ else
324
330
  run_on_gears(ssh_command_for_op(options.gears), groups)
325
331
  end
326
332
 
@@ -429,12 +435,13 @@ module RHC::Commands
429
435
  result
430
436
  end
431
437
 
432
- def create_app(name, cartridges, rest_domain, gear_size=nil, scale=nil, from_code=nil)
438
+ def create_app(name, cartridges, rest_domain, gear_size=nil, scale=nil, from_code=nil, environment_variables=nil)
433
439
  app_options = {:cartridges => Array(cartridges)}
434
440
  app_options[:gear_profile] = gear_size if gear_size
435
441
  app_options[:scale] = scale if scale
436
442
  app_options[:initial_git_url] = from_code if from_code
437
443
  app_options[:debug] = true if @debug
444
+ app_options[:environment_variables] = environment_variables.map{ |item| item.to_hash } if environment_variables.present?
438
445
  debug "Creating application '#{name}' with these options - #{app_options.inspect}"
439
446
  rest_app = rest_domain.add_application(name, app_options)
440
447
  debug "'#{rest_app.name}' created"
@@ -449,11 +456,11 @@ module RHC::Commands
449
456
  end
450
457
 
451
458
  def add_jenkins_app(rest_domain)
452
- create_app(jenkins_app_name, "jenkins-1.4", rest_domain)
459
+ create_app(jenkins_app_name, jenkins_cartridge_name, rest_domain)
453
460
  end
454
461
 
455
462
  def add_jenkins_cartridge(rest_app)
456
- rest_app.add_cartridge("jenkins-client-1.4")
463
+ rest_app.add_cartridge(jenkins_client_cartridge_name)
457
464
  end
458
465
 
459
466
  def add_jenkins_client_to(rest_app, messages)
@@ -528,6 +535,14 @@ module RHC::Commands
528
535
  end || "jenkins"
529
536
  end
530
537
 
538
+ def jenkins_cartridge_name
539
+ jenkins_cartridges.last.name
540
+ end
541
+
542
+ def jenkins_client_cartridge_name
543
+ jenkins_client_cartridges.last.name
544
+ end
545
+
531
546
  def run_nslookup(host)
532
547
  # :nocov:
533
548
  `nslookup #{host}`
@@ -586,7 +601,7 @@ WARNING: Your application was created successfully but had problems during
586
601
 
587
602
  $ rhc app delete #{rest_app.name} --confirm
588
603
 
589
- Please contact us if you are unable to successfully create your
604
+ Please contact us if you are unable to successfully create your
590
605
  application:
591
606
 
592
607
  Support - https://www.openshift.com/support
@@ -624,6 +639,6 @@ WARNING_OUTPUT
624
639
 
625
640
  def issues?
626
641
  not @issues.nil?
627
- end
642
+ end
628
643
  end
629
644
  end
@@ -53,11 +53,6 @@ class RHC::Commands::Base
53
53
 
54
54
  class InvalidCommand < StandardError ; end
55
55
 
56
- def self.inherited(klass)
57
- unless klass == RHC::Commands::Base
58
- end
59
- end
60
-
61
56
  def self.method_added(method)
62
57
  return if self == RHC::Commands::Base
63
58
  return if private_method_defined? method
@@ -128,7 +123,8 @@ class RHC::Commands::Base
128
123
  :description => description,
129
124
  :context_helper => options[:context],
130
125
  :required => options[:required],
131
- :deprecated => options[:deprecated]
126
+ :deprecated => options[:deprecated],
127
+ :option_type => options[:option_type]
132
128
  }
133
129
  end
134
130
 
@@ -157,17 +153,17 @@ class RHC::Commands::Base
157
153
  }));
158
154
  end
159
155
 
160
- private
161
- def self.options_metadata
162
- options[:options] ||= []
163
- end
164
- def self.args_metadata
165
- options[:args] ||= []
166
- end
167
- def self.aliases
168
- options[:aliases] ||= []
169
- end
170
- def self.options
171
- @options ||= {}
172
- end
156
+ private
157
+ def self.options_metadata
158
+ options[:options] ||= []
159
+ end
160
+ def self.args_metadata
161
+ options[:args] ||= []
162
+ end
163
+ def self.aliases
164
+ options[:aliases] ||= []
165
+ end
166
+ def self.options
167
+ @options ||= {}
168
+ end
173
169
  end