wise_omf 0.9.2 → 0.9.3
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/lib/wise_omf/uid_helper.rb +50 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee2ec7e4995e8cec824ca57603e8e00002ebe1ab
|
4
|
+
data.tar.gz: 63bcb041131b5a8d73007d6368a8aebe87135b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08217ab5ec0bff2a7fa3959798f29588816152f9c6b3f90ae30f4a899825d99624a0cb2841ea64ce754f86f117a8c30c93e70b5e1f80c2a3db0f8a6021c9e59
|
7
|
+
data.tar.gz: 438c52c2dc91c9baa92a2076625e1b1a7de8c68a4cc24b4a5cac120046a6212843f39e09d059263286f6779941be585cc7a1b57e9c01c7c3f572ba5a590a3a11
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'json'
|
3
|
+
require 'protocol_buffers'
|
4
|
+
|
5
|
+
require 'wise_omf/protobuf'
|
6
|
+
|
7
|
+
|
8
|
+
module WiseOMFUtils
|
9
|
+
class UIDHelper
|
10
|
+
|
11
|
+
def self.reservation_uid(reservation)
|
12
|
+
return to_uid(sort_secret_reservation_keys(reservation))
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.node_group_uid(reservation, nodeUrns)
|
16
|
+
return to_uid([sort_secret_reservation_keys(reservation), sort_node_urns(nodeUrns)])
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def self.sort_node_urns(nodeUrns)
|
21
|
+
result = nodeUrns.to_a.sort!{|a,b| a <=> b}
|
22
|
+
return result
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.sort_secret_reservation_keys(reservation)
|
26
|
+
keys = reservation.to_hash[:secretReservationKeys]
|
27
|
+
# we don't need the username. Delete it from al SRKs:
|
28
|
+
keys.each{|k| k.delete(:username)}
|
29
|
+
|
30
|
+
# Sort the keys:
|
31
|
+
keys.sort!{|a,b|
|
32
|
+
prefixComp = a.to_hash[:nodeUrnPrefix].downcase <=> b.to_hash[:nodeUrnPrefix].downcase
|
33
|
+
if prefixComp != 0
|
34
|
+
prefixComp
|
35
|
+
else
|
36
|
+
a.to_hash[:key] <=> b.to_hash[:key]
|
37
|
+
end
|
38
|
+
}
|
39
|
+
return keys
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.to_uid(object)
|
43
|
+
return Base64.encode64(JSON.generate(object)).gsub("\n", "-")
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.from_uid(uid)
|
47
|
+
return JSON.parse(Base64.decode64(uid.gsub("-","\n")))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wise_omf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Mende
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem provides helpers for working with the testbed runtime via the
|
14
14
|
OMF (Orbit Measurement Framework)
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- lib/wise_omf/protobuf.rb
|
22
22
|
- lib/wise_omf/server.rb
|
23
23
|
- lib/wise_omf/client.rb
|
24
|
+
- lib/wise_omf/uid_helper.rb
|
24
25
|
homepage: https://github.com/wisebed/wiseomf
|
25
26
|
licenses:
|
26
27
|
- MIT
|
@@ -46,4 +47,3 @@ signing_key:
|
|
46
47
|
specification_version: 4
|
47
48
|
summary: WiseOMF Utility Gem
|
48
49
|
test_files: []
|
49
|
-
has_rdoc:
|