ood_appkit 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/clusters.yml +14 -6
- data/lib/ood_appkit/configuration.rb +2 -1
- data/lib/ood_appkit/servers/ganglia.rb +62 -22
- data/lib/ood_appkit/version.rb +1 -1
- data/lib/ood_appkit.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb6d20b4747f2021e1f88650dbccf1128a3783c
|
4
|
+
data.tar.gz: c04296d552fb068865ee30feaee0addba8a6bd76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed370c8a4107a89f89ef3cbe0354f39cf762854d064a7d9a7a2177632a77cef1a3be94ad452d2da4ea7be3260506d8602f2b9a0813d185b0bc5f28a5d0eec5b
|
7
|
+
data.tar.gz: 905ca68526ade3d6299a1bcaedf32035c73f9476ea28dcf181203e3820b1423916730c661401f1bccb3381a178b4abfc84841c5a2c0d5bb9d3fb87c28507c96a
|
data/README.md
CHANGED
@@ -542,7 +542,7 @@ ganglia_server.uri.to_s
|
|
542
542
|
#=> "https://www.ganglia.com/gweb/graph.php?c=MyCluster"
|
543
543
|
|
544
544
|
# To add query values as options for the server
|
545
|
-
ganglia_server.
|
545
|
+
ganglia_server.uri(query_values: {g: 'cpu_report'}).to_s
|
546
546
|
#=> "https://www.ganglia.com/gweb/graph.php?c=MyCluster&g=cpu_report"
|
547
547
|
```
|
548
548
|
|
data/config/clusters.yml
CHANGED
@@ -19,10 +19,14 @@ v1:
|
|
19
19
|
ganglia:
|
20
20
|
type: 'OodAppkit::Servers::Ganglia'
|
21
21
|
host: 'cts05.osc.edu'
|
22
|
-
scheme: 'https'
|
23
|
-
|
24
|
-
|
22
|
+
scheme: 'https://'
|
23
|
+
segments:
|
24
|
+
- 'gweb'
|
25
|
+
- 'graph.php'
|
26
|
+
query:
|
25
27
|
c: 'Oakley nodes'
|
28
|
+
opt_query:
|
29
|
+
h: '%{h}.ten.osc.edu'
|
26
30
|
version: '3'
|
27
31
|
ruby:
|
28
32
|
title: 'Ruby'
|
@@ -49,10 +53,14 @@ v1:
|
|
49
53
|
ganglia:
|
50
54
|
type: 'OodAppkit::Servers::Ganglia'
|
51
55
|
host: 'cts05.osc.edu'
|
52
|
-
scheme: 'https'
|
53
|
-
|
54
|
-
|
56
|
+
scheme: 'https://'
|
57
|
+
segments:
|
58
|
+
- 'gweb'
|
59
|
+
- 'graph.php'
|
60
|
+
query:
|
55
61
|
c: 'Ruby'
|
62
|
+
opt_query:
|
63
|
+
h: '%{h}.ten.osc.edu'
|
56
64
|
version: '3'
|
57
65
|
quick:
|
58
66
|
title: 'Quick'
|
@@ -65,8 +65,9 @@ module OodAppkit
|
|
65
65
|
self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT']
|
66
66
|
|
67
67
|
# Initialize list of available clusters
|
68
|
+
c_conf = ENV['OOD_CLUSTERS'] || ( OOD_CONFIG.join('clusters.yml') if OOD_CONFIG.join('clusters.yml').file? )
|
68
69
|
self.clusters = OpenStruct.new
|
69
|
-
clusters.all = OodAppkit::Cluster.all(
|
70
|
+
clusters.all = OodAppkit::Cluster.all( c_conf ? {file: c_conf} : {} )
|
70
71
|
def clusters.hpc
|
71
72
|
all.select {|k,v| v.hpc_cluster?}
|
72
73
|
end
|
@@ -2,41 +2,81 @@ module OodAppkit
|
|
2
2
|
module Servers
|
3
3
|
# This defines a Ganglia server and defining parameters
|
4
4
|
class Ganglia < Server
|
5
|
-
#
|
6
|
-
# @
|
7
|
-
|
5
|
+
# Template used to describe URI
|
6
|
+
# @see https://www.rfc-editor.org/rfc/rfc6570.txt RFC describing template format
|
7
|
+
TEMPLATE = '{+scheme}{host}{/segments*}{?query*}'
|
8
|
+
|
9
|
+
# The scheme of the URI
|
10
|
+
# @example Scheme of SSL protocol
|
11
|
+
# "my_ganglia.scheme" #=> "https://"
|
12
|
+
# @return [String] scheme of uri
|
13
|
+
attr_reader :scheme
|
14
|
+
|
15
|
+
# The segments used to describe the path of the URI
|
16
|
+
# @example Segments for URI with path "/ganglia/gweb.php"
|
17
|
+
# "my_ganglia.segments"
|
18
|
+
# #=> ["ganglia", "gweb.php"]
|
19
|
+
# @return [Array<String>] segments of uri
|
20
|
+
attr_reader :segments
|
21
|
+
|
22
|
+
# The required query values of the URI
|
23
|
+
# @example Required cluster query value
|
24
|
+
# "my_ganglia.query"
|
25
|
+
# #=> {c: "MyCluster"}
|
26
|
+
# @return [Hash] required query values of uri
|
27
|
+
attr_reader :query
|
28
|
+
|
29
|
+
# Optional query values of the URI, these query values are
|
30
|
+
# only defined if specified
|
31
|
+
# @return [Hash] optional query values of uri
|
32
|
+
attr_reader :opt_query
|
8
33
|
|
9
34
|
# The version of this software
|
10
35
|
# @return [String] version of software
|
11
36
|
attr_reader :version
|
12
37
|
|
13
|
-
# @param scheme [String] scheme
|
14
|
-
# @param
|
15
|
-
#
|
38
|
+
# @param scheme [String] the scheme used for URI
|
39
|
+
# @param segments [Array<String>] the segments used to
|
40
|
+
# construct path of URI
|
41
|
+
# @param query [Hash] hash of query values used for
|
42
|
+
# URI
|
43
|
+
# @param opt_query [Hash] hash of optional query
|
44
|
+
# values if they exist
|
16
45
|
# @param version [String] version of server software
|
17
|
-
def initialize(scheme:,
|
46
|
+
def initialize(scheme:, segments: [], query: {}, opt_query: {}, version:, **kwargs)
|
18
47
|
super(kwargs)
|
19
48
|
|
20
49
|
# uri
|
21
|
-
@
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
query_values: query_values
|
26
|
-
})
|
50
|
+
@scheme = scheme
|
51
|
+
@segments = segments
|
52
|
+
@query = query
|
53
|
+
@opt_query = opt_query
|
27
54
|
|
28
|
-
# version
|
55
|
+
# version
|
29
56
|
@version = version
|
30
57
|
end
|
31
58
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# @
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
59
|
+
# The full hash of query values used to construct URI
|
60
|
+
# @param other_query [Hash] user specified query hash
|
61
|
+
# @return [Hash] full hash of query values
|
62
|
+
def query_values(other_query)
|
63
|
+
query.merge(
|
64
|
+
other_query.each_with_object({}) do |(k, v), h|
|
65
|
+
h[k] = opt_query.has_key?(k) ? (opt_query[k] % query.merge(other_query)) : v
|
66
|
+
end
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
# The URI used to access information about given cluster
|
71
|
+
# @param query_values [Hash] user specified query hash
|
72
|
+
# @return [Addressable] the uri for ganglia server
|
73
|
+
def uri(query_values: {})
|
74
|
+
Addressable::Template.new(TEMPLATE).expand({
|
75
|
+
scheme: scheme,
|
76
|
+
host: host,
|
77
|
+
segments: segments,
|
78
|
+
query: query_values(query_values)
|
79
|
+
})
|
40
80
|
end
|
41
81
|
end
|
42
82
|
end
|
data/lib/ood_appkit/version.rb
CHANGED
data/lib/ood_appkit.rb
CHANGED
@@ -15,6 +15,9 @@ require 'ood_appkit/server'
|
|
15
15
|
|
16
16
|
# The main namespace for OodAppkit. Provides a global configuration.
|
17
17
|
module OodAppkit
|
18
|
+
# Global OOD config location
|
19
|
+
OOD_CONFIG = Pathname.new '/etc/ood/config'
|
20
|
+
|
18
21
|
extend Configuration
|
19
22
|
require 'ood_appkit/engine' if defined?(Rails)
|
20
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ood_appkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Franz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|