foreman_reserve 0.1.7 → 0.1.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/foreman_reserve/api/hosts_controller.rb +7 -14
- data/foreman_reserve.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb84c64163abd43a3594ba08ec85ba60af1422ad
|
|
4
|
+
data.tar.gz: be9a4bb75f9d66261e45731fb109876b3ad20bae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8dcbbb655cd823f700c8d4d29dbbcc8763fb893f065299af666935cb84c7fe6c32f64f637170c5de2f37e381e5dffc406d646ebfeefa570041984947d4ea58e3
|
|
7
|
+
data.tar.gz: 55e934ec17a96fa945b8f589574f0fd5923537c62a2221a51e1ffd9f3c0be9e52c882f59ffe8321202dbefa3700987c3af7aaaa7602e28bb87b13039a7d76fbf
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
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.
|
|
10
|
+
hosts = hosts.search_for(query)
|
|
11
|
+
hosts.find_all do |host|
|
|
12
12
|
params = host.info()['parameters']
|
|
13
|
-
|
|
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.
|
|
23
|
+
hosts = hosts.search_for(query)
|
|
24
|
+
hosts.find_all do |host|
|
|
27
25
|
params = host.info()['parameters']
|
|
28
|
-
|
|
29
|
-
params.
|
|
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
|
data/foreman_reserve.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = "foreman_reserve"
|
|
5
|
-
s.version = "0.1.
|
|
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"]
|