foreman_reserve 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edaeb4e6dd24d5ca57297860ae94f8e49f47ac39
4
- data.tar.gz: 79c1507a10634769373a92ba9f9d256d862ae155
3
+ metadata.gz: bb84c64163abd43a3594ba08ec85ba60af1422ad
4
+ data.tar.gz: be9a4bb75f9d66261e45731fb109876b3ad20bae
5
5
  SHA512:
6
- metadata.gz: 1c929a0f33b04449f517359cd7cb292cf1abb9e41fb1968e114e6fd6b1ed3d814c653da9be2715a26fe0510c4691eee39c47b77209627ffcddf03aa5a6c1da55
7
- data.tar.gz: 63c57ee74c1a651740656ed52defbc1ee28de60e869e04e1b755424693ceecd7153c42f97ac52c38b8fc26aea2c37e41ad18145f02acb2a187822e258bbe5b9d
6
+ metadata.gz: 8dcbbb655cd823f700c8d4d29dbbcc8763fb893f065299af666935cb84c7fe6c32f64f637170c5de2f37e381e5dffc406d646ebfeefa570041984947d4ea58e3
7
+ data.tar.gz: 55e934ec17a96fa945b8f589574f0fd5923537c62a2221a51e1ffd9f3c0be9e52c882f59ffe8321202dbefa3700987c3af7aaaa7602e28bb87b13039a7d76fbf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -7,14 +7,12 @@ module Api
7
7
  # @param query [String] Query to filter the hosts with
8
8
  def get_reserved(query='')
9
9
  hosts = User.current.admin? ? Host::Managed : Host::Managed.my_hosts
10
- hosts.search_for(query)
11
- hosts.each do |host|
10
+ hosts = hosts.search_for(query)
11
+ hosts.find_all do |host|
12
12
  params = host.info()['parameters']
13
- if params and
13
+ params and
14
14
  params.key?('RESERVED') and
15
15
  params['RESERVED'] != 'false'
16
- host
17
- end
18
16
  end
19
17
  end
20
18
 
@@ -22,14 +20,12 @@ module Api
22
20
  # @param query [String] Query to filter the hosts with
23
21
  def get_free(query='')
24
22
  hosts = User.current.admin? ? Host::Managed : Host::Managed.my_hosts
25
- hosts.search_for(query)
26
- hosts.each do |host|
23
+ hosts = hosts.search_for(query)
24
+ hosts.find_all do |host|
27
25
  params = host.info()['parameters']
28
- if params and
29
- params.has_key('RESERVED') and
26
+ params and
27
+ params.key?('RESERVED') and
30
28
  params['RESERVED'] == 'false'
31
- host
32
- end
33
29
  end
34
30
  end
35
31
 
@@ -72,9 +68,6 @@ module Api
72
68
  return not_found if potential_hosts.empty?
73
69
  return not_acceptable if potential_hosts.count < amount
74
70
  @hosts = potential_hosts[0..(amount-1)].each do |host|
75
- logger.error host.class.name
76
- logger.error host.class.instance_methods(false)
77
- logger.error Host.class.instance_methods(false)
78
71
  host.reserve!(reason)
79
72
  end
80
73
  ensure
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "foreman_reserve"
5
- s.version = "0.1.7"
5
+ s.version = "0.1.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Joseph Mitchell Magen", "David Caro"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_reserve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Mitchell Magen