vmc 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/Rakefile +3 -3
  2. data/lib/vmc.rb +15 -13
  3. metadata +6 -8
  4. data/bin/vmc.bat +0 -1
data/Rakefile CHANGED
@@ -6,15 +6,15 @@ require 'spec/rake/spectask'
6
6
 
7
7
  spec = Gem::Specification.new do |s|
8
8
  s.name = "vmc"
9
- s.version = "0.0.7"
9
+ s.version = "0.0.8"
10
10
  s.author = "Ezra Zygmuntowicz"
11
11
  s.email = "ez@vmware.com"
12
12
  s.homepage = "http://vmware.com"
13
- s.description = s.summary = "A gem that provides command line access to the VMWare Cloud Application Platform"
13
+ s.description = s.summary = "A gem that provides command line access to the VMware Cloud Application Platform"
14
14
  s.platform = Gem::Platform::RUBY
15
15
  s.has_rdoc = true
16
16
  s.extra_rdoc_files = ["README", "LICENSE"]
17
- s.executables = %w(vmc vmc.bat)
17
+ s.executables = %w(vmc)
18
18
  # Uncomment this to add a dependency
19
19
  s.add_dependency "main", "~> 4.3.0"
20
20
  s.add_dependency "arrayfields", "~> 4.7.4"
data/lib/vmc.rb CHANGED
@@ -67,7 +67,7 @@ module VMC
67
67
  response = HTTPClient.get try_host
68
68
  if response.status != 200
69
69
  display "New Target host is not valid: '#{target_host_display}'"
70
- show_response = ask "Would you like to use one of these (y/n)? "
70
+ show_response = ask "Would you like see the response [yN]? "
71
71
  display response.content if show_response.upcase == 'Y'
72
72
  exit(1)
73
73
  end
@@ -637,7 +637,7 @@ module VMC
637
637
  if !service_names.empty? && !service_name
638
638
  list_services(get_user_service_names, "The following services have been provisioned for you:")
639
639
  display ''
640
- use_existing = ask "Would you like to use one of these (y/n)? "
640
+ use_existing = ask "Would you like to use one of these [yN]? "
641
641
  if use_existing.upcase == 'Y'
642
642
  begin
643
643
  service_name = ask "Which service (name)? "
@@ -1019,10 +1019,10 @@ module VMC
1019
1019
  failed = false
1020
1020
  display "Trying to start Application: '#{appname}'."
1021
1021
  loop do
1022
- display ".", false unless count > 9
1023
- sleep 1
1022
+ display ".", false unless count > 19
1023
+ sleep 0.5
1024
1024
  begin
1025
- if app_started_properly(appname)
1025
+ if app_started_properly(appname, count > 6)
1026
1026
  display ''
1027
1027
  break;
1028
1028
  elsif !crashes(appname, false).empty?
@@ -1036,14 +1036,14 @@ module VMC
1036
1036
  end
1037
1037
  failed = true
1038
1038
  break
1039
- elsif count > 9
1039
+ elsif count > 19
1040
1040
  log_lines_displayed = grab_startup_tail(appname, log_lines_displayed)
1041
1041
  end
1042
1042
  rescue => e
1043
1043
  display e.message, false
1044
1044
  end
1045
1045
  count += 1
1046
- if count > 300 # 5 minutes
1046
+ if count > 600 # 5 minutes
1047
1047
  error "\n\nApplication is taking too long to start, check your logs"
1048
1048
  break
1049
1049
  end
@@ -1382,11 +1382,11 @@ module VMC
1382
1382
  since + new_lines
1383
1383
  end
1384
1384
 
1385
- def app_started_properly(appname)
1385
+ def app_started_properly(appname, error_on_health)
1386
1386
  check_for_token
1387
1387
  response = get_app_internal @droplets_uri, appname, auth_hdr
1388
1388
  if response.status != 200
1389
- error "Application '#{appname}'s state is undetermined, not enough information available at this time."
1389
+ error "\nApplication '#{appname}'s state is undetermined, not enough information available at this time."
1390
1390
  return
1391
1391
  end
1392
1392
 
@@ -1395,7 +1395,8 @@ module VMC
1395
1395
  case health(droplet)
1396
1396
  when 'N/A'
1397
1397
  # Health manager not running.
1398
- error "Application '#{appname}'s state is undetermined, not enough information available at this time."
1398
+ error "\nApplication '#{appname}'s state is undetermined, not enough information available at this time." if error_on_health
1399
+ return false
1399
1400
  when 'RUNNING'
1400
1401
  return true
1401
1402
  else
@@ -1528,7 +1529,7 @@ module VMC
1528
1529
  info_json = JSON.parse(@check.content)
1529
1530
  usage = info_json['usage']
1530
1531
  limits = info_json['limits']
1531
- return unless limits['apps']
1532
+ return unless usage and limits and limits['apps']
1532
1533
  if limits['apps'] == usage['apps']
1533
1534
  display "Not enough capacity for operation."
1534
1535
  tapps = limits['apps'] || 0
@@ -1541,6 +1542,7 @@ module VMC
1541
1542
  info_json = JSON.parse(@check.content)
1542
1543
  usage = info_json['usage']
1543
1544
  limits = info_json['limits']
1545
+ return unless usage and limits
1544
1546
  available_for_use = limits['memory'].to_i - usage['memory'].to_i
1545
1547
  if mem_wanted > available_for_use
1546
1548
  info_json = JSON.parse(@check.content)
@@ -1556,8 +1558,8 @@ module VMC
1556
1558
  default = ['64M', '128M', '256M', '512M', '1G', '2G']
1557
1559
  info_json = JSON.parse(@check.content)
1558
1560
 
1559
- default unless info_json
1560
- default unless (usage = info_json['usage'] and limits = info_json['limits'])
1561
+ return default unless info_json
1562
+ return default unless (usage = info_json['usage'] and limits = info_json['limits'])
1561
1563
 
1562
1564
  available_for_use = limits['memory'].to_i - usage['memory'].to_i
1563
1565
  check_has_capacity_for(64) if available_for_use < 64
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ezra Zygmuntowicz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-09 00:00:00 -08:00
18
+ date: 2010-11-15 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -129,11 +129,10 @@ dependencies:
129
129
  version: 1.6.1
130
130
  type: :runtime
131
131
  version_requirements: *id007
132
- description: A gem that provides command line access to the VMWare Cloud Application Platform
132
+ description: A gem that provides command line access to the VMware Cloud Application Platform
133
133
  email: ez@vmware.com
134
134
  executables:
135
135
  - vmc
136
- - vmc.bat
137
136
  extensions: []
138
137
 
139
138
  extra_rdoc_files:
@@ -163,7 +162,6 @@ files:
163
162
  - vendor/gems/httpclient/lib/tags
164
163
  - vendor/gems/httpclient/VERSION
165
164
  - bin/vmc
166
- - bin/vmc.bat
167
165
  has_rdoc: true
168
166
  homepage: http://vmware.com
169
167
  licenses: []
@@ -197,6 +195,6 @@ rubyforge_project:
197
195
  rubygems_version: 1.3.7
198
196
  signing_key:
199
197
  specification_version: 3
200
- summary: A gem that provides command line access to the VMWare Cloud Application Platform
198
+ summary: A gem that provides command line access to the VMware Cloud Application Platform
201
199
  test_files: []
202
200
 
@@ -1 +0,0 @@
1
- @ ruby "%~dp0vmc" %1 %2 %3 %4 %5 %6