project-fifo-ruby 0.3.0 → 0.3.1

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.
@@ -5,10 +5,9 @@ class ProjectFifo
5
5
 
6
6
  attr_reader :fifo, :namespace
7
7
 
8
- def initialize(fifo, namespace, name="name")
8
+ def initialize(fifo, namespace)
9
9
  @namespace = namespace
10
10
  @fifo = fifo
11
- @name = name
12
11
  end
13
12
 
14
13
  def list
@@ -25,7 +24,7 @@ class ProjectFifo
25
24
  end
26
25
 
27
26
  def get_by_name(name)
28
- list.map{|i| get(i) }.select{|i| i[@name] == name}
27
+ list.map{|i| get(i) }.select{|i| i['name'] == name}
29
28
  end
30
29
 
31
30
  def metadata(uuid, key, value)
@@ -3,16 +3,24 @@
3
3
  class ProjectFifo
4
4
 
5
5
  class VM < ProjectFifo::Resource
6
-
6
+
7
7
  def initialize(fifo)
8
- super(fifo, 'vms', 'alias')
8
+ super(fifo, 'vms')
9
9
  end
10
10
 
11
+ def get_by_alias(a)
12
+ list.map{|i| get(i) }.select{|i| i['config']['alias'] == a }
13
+ end
14
+
15
+ def get_by_name(n)
16
+ get_by_alias(n)
17
+ end
18
+
11
19
  %w{ start stop reboot }.each do |act|
12
20
  define_method(act) { |uuid, force| action(uuid, act, force) }
13
21
  end
14
22
 
15
- VALIDATIONS = {
23
+ VALIDATIONS = {
16
24
  package: 'string',
17
25
  dataset: 'string',
18
26
  config: {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "project-fifo-ruby"
5
- spec.version = '0.3.0'
5
+ spec.version = '0.3.1'
6
6
  spec.authors = [ "Brian Akins" ]
7
7
  spec.email = [ "brian@akins.org" ]
8
8
  spec.description = %q{A simple incomplete project-fifo client API}
data/test.rb CHANGED
@@ -10,11 +10,12 @@ pp fifo.packages.get_by_name("medium")
10
10
  pp fifo.ipranges.get_by_name("default")
11
11
  pp fifo.datasets.get_by_name("ubuntu-12.04")
12
12
  pp fifo.vms.get_by_name("netatalk")
13
+
13
14
  exit
14
15
 
15
16
  fifo.vms.list.each do |id|
16
17
  vm = fifo.vms[id]
17
- pp vm.config.dataset
18
+ pp vm
18
19
  end
19
20
 
20
21
  package = fifo.packages.list.first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: project-fifo-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: