virtualmaster 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/vmaster/cli.rb CHANGED
@@ -14,6 +14,11 @@ module VirtualMaster
14
14
 
15
15
  @@config = config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
16
16
 
17
+ unless @@config[:profiles]
18
+ puts "WARNING: Please, reconfigure virtualmaster-cli (delete your '~/.virtualmaster' and run `virtualmaster config` again). This way you can use custom instance profiles correctly (new in version 0.0.5)"
19
+ puts
20
+ end
21
+
17
22
  @@api = DeltaCloud.new(@@config[:username], @@config[:password], VirtualMaster::DEFAULT_URL)
18
23
  end
19
24
 
@@ -32,7 +32,8 @@ command :config do |c|
32
32
  'username' => options.username,
33
33
  'password' => options.password,
34
34
  'default_image' => VirtualMaster::DEFAULT_IMAGE,
35
- 'images' => VirtualMaster::IMAGES
35
+ 'images' => VirtualMaster::IMAGES,
36
+ 'profiles' => VirtualMaster::PROFILES
36
37
  }
37
38
 
38
39
  File.open(config_file, 'w') do |f|
@@ -20,7 +20,7 @@ module VirtualMaster
20
20
  },
21
21
  :micro => {
22
22
  :memory => 512,
23
- :storage => 6144
23
+ :storage => 10240,
24
24
  },
25
25
  :milli => {
26
26
  :memory => 1024,
@@ -28,19 +28,18 @@ module VirtualMaster
28
28
  },
29
29
  :small => {
30
30
  :memory => 2048,
31
- :storage => 30720
31
+ :storage => 30720,
32
32
  },
33
33
  :medium => {
34
34
  :memory => 4096,
35
- :storage => 40960
35
+ :storage => 40960,
36
+ },
37
+ :large => {
38
+ :memory => 8192,
39
+ :storage => 8192,
36
40
  }
37
- #:large => {
38
- # :memory => 8192,
39
- # :storage => 8192
40
- #}
41
41
  }
42
42
 
43
-
44
43
  module Helpers
45
44
  def self.get_instances
46
45
  VirtualMaster::CLI.api.instances
@@ -57,7 +56,7 @@ module VirtualMaster
57
56
  def self.get_hw_profile(memory, storage)
58
57
  api = VirtualMaster::CLI.api
59
58
 
60
- profile_list = api.hardware_profiles.reject { |p| p.memory.value.to_i != memory && p.storage.value.to_i != storage }
59
+ profile_list = api.hardware_profiles.select { |p| p.memory.value.to_i == memory && p.storage.value.to_i == storage }
61
60
 
62
61
  profile_list.first
63
62
  end
@@ -55,7 +55,9 @@ command :create do |c|
55
55
  # instance hardware profile
56
56
  profile_name = options.profile || VirtualMaster::DEFAULT_PROFILE
57
57
 
58
- profile = VirtualMaster::PROFILES[profile_name.to_sym]
58
+ profile = VirtualMaster::CLI.config[:profiles][profile_name.to_sym]
59
+ profile = VirtualMaster::PROFILES[profile_name.to_sym] unless profile
60
+
59
61
  abort "Image name '#{options.profile}' not recognized!" unless profile
60
62
 
61
63
  hwp = VirtualMaster::Helpers.get_hw_profile(profile[:memory], profile[:storage])
@@ -1,3 +1,3 @@
1
1
  module VirtualMaster
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualmaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-26 00:00:00.000000000 Z
12
+ date: 2012-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
16
- requirement: &70140390251200 !ruby/object:Gem::Requirement
16
+ requirement: &70178919324560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.1.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70140390251200
24
+ version_requirements: *70178919324560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: deltacloud-client
27
- requirement: &70140390250700 !ruby/object:Gem::Requirement
27
+ requirement: &70178919324060 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.5.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70140390250700
35
+ version_requirements: *70178919324060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: terminal-table
38
- requirement: &70140255842280 !ruby/object:Gem::Requirement
38
+ requirement: &70178922995280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.4.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70140255842280
46
+ version_requirements: *70178922995280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: net-ssh
49
- requirement: &70140255840660 !ruby/object:Gem::Requirement
49
+ requirement: &70178922993280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70140255840660
57
+ version_requirements: *70178922993280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70140255839140 !ruby/object:Gem::Requirement
60
+ requirement: &70178922992020 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70140255839140
68
+ version_requirements: *70178922992020
69
69
  description: Command line interface to VirtualMaster. Control your virtual infrastructure.
70
70
  email:
71
71
  - radim@laststation.net