ocular 0.1.6 → 0.1.7
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/bin/ocular +34 -3
- data/lib/ocular/dsl/dsl.rb +10 -1
- data/lib/ocular/dsl/etcd.rb +3 -1
- data/lib/ocular/dsl/fog.rb +4 -0
- data/lib/ocular/dsl/orbit.rb +3 -0
- data/lib/ocular/dsl/ssh.rb +1 -0
- data/lib/ocular/event/eventbase.rb +0 -2
- data/lib/ocular/version.rb +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: 33d5f708edcb7dd43619b5222bfa86e5897d84ef
|
4
|
+
data.tar.gz: 9dcd6fd9dba29ebebc23c0ea227d12cf73b64da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2c902cde308bab0ce9885c4d64f665b9a10c296f3ac52ebe3fd53c3ef05e924762ad3ee088c9ccdfa1f2c6f896facc3524ebb836c3fb1ae036009236d68b17
|
7
|
+
data.tar.gz: a2b3a5f4a76be86332520655793958c81f996513be1fb2cc2a84f26c3a3c235a0e01ac4fd700af3ff3727f0801d88f66ae85184bb6879fc92bc1d944a8c0b8b8
|
data/bin/ocular
CHANGED
@@ -69,7 +69,31 @@ end # class OptparseExample
|
|
69
69
|
|
70
70
|
options = OptparseExample.parse(ARGV)
|
71
71
|
|
72
|
-
|
72
|
+
begin
|
73
|
+
Ocular::Settings.load_from_file(Ocular::Settings.find_settings_file_from_system(options.settings))
|
74
|
+
rescue Errno::ENOENT
|
75
|
+
puts "Could not find #{options.settings} in any search path."
|
76
|
+
puts "Please create a yaml settings file in either ~/.ocular.yaml or /etc/ocular.yaml"
|
77
|
+
puts "Here's an example file:\n"
|
78
|
+
puts "
|
79
|
+
aws:
|
80
|
+
aws_access_key_id: AKI...
|
81
|
+
aws_secret_access_key: ....
|
82
|
+
ssh:
|
83
|
+
keys:
|
84
|
+
- /home/user/.ssh/id_dsa
|
85
|
+
user: ubuntu
|
86
|
+
|
87
|
+
inputs:
|
88
|
+
http:
|
89
|
+
port: 8083
|
90
|
+
etcd:
|
91
|
+
host: etc
|
92
|
+
port: 4001
|
93
|
+
|
94
|
+
"
|
95
|
+
exit -1
|
96
|
+
end
|
73
97
|
|
74
98
|
if options.server
|
75
99
|
if !options.root && !Ocular::Settings.get(:script_root)
|
@@ -88,7 +112,14 @@ else
|
|
88
112
|
# Start shell mode
|
89
113
|
|
90
114
|
if ARGV.length == 0
|
91
|
-
puts "Missing script file to run, starting ocular interactive shell. use -h to get
|
115
|
+
puts "Missing script file to run, starting ocular interactive shell. use \"ocular -h\" to get full options"
|
116
|
+
puts ""
|
117
|
+
longest_name = $dsl_help.keys.max_by(&:length).length
|
118
|
+
$dsl_help.each do |cmd, help|
|
119
|
+
spacing = " "*(longest_name.to_i+1-cmd.length)
|
120
|
+
puts " #{cmd}#{spacing}#{help}"
|
121
|
+
end
|
122
|
+
puts ""
|
92
123
|
|
93
124
|
ARGV.clear
|
94
125
|
require 'irb'
|
@@ -106,7 +137,7 @@ else
|
|
106
137
|
IRB.conf[:PROMPT_MODE] = :MY_PROJECT
|
107
138
|
|
108
139
|
IRB.conf[:RC] = false
|
109
|
-
|
140
|
+
IRB.conf[:AUTO_INDENT] = true
|
110
141
|
require 'irb/completion'
|
111
142
|
require 'irb/ext/save-history'
|
112
143
|
IRB.conf[:READLINE] = true
|
data/lib/ocular/dsl/dsl.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
|
2
|
+
$dsl_help = {}
|
3
|
+
|
4
|
+
def add_help(name, help)
|
5
|
+
$dsl_help[name] = help
|
6
|
+
end
|
7
|
+
|
8
|
+
|
1
9
|
require 'ocular/dsl/etcd.rb'
|
2
10
|
require 'ocular/dsl/fog.rb'
|
3
11
|
require 'ocular/dsl/logging.rb'
|
4
12
|
require 'ocular/dsl/ssh.rb'
|
5
|
-
require 'ocular/dsl/orbit.rb'
|
13
|
+
require 'ocular/dsl/orbit.rb'
|
14
|
+
|
data/lib/ocular/dsl/etcd.rb
CHANGED
@@ -6,11 +6,13 @@ class Ocular
|
|
6
6
|
module Etcd
|
7
7
|
@@__etcd_instance = nil
|
8
8
|
|
9
|
+
add_help "etcd", "Returns an etcd client instance"
|
10
|
+
|
9
11
|
def etcd()
|
10
12
|
if @@__etcd_instance
|
11
13
|
return @@__etcd_instance
|
12
14
|
end
|
13
|
-
|
15
|
+
|
14
16
|
settings = ::Ocular::Settings::get(:inputs)[:etcd] || {}
|
15
17
|
@@__etcd_instance = ::Etcd.client(
|
16
18
|
host: (settings[:host] || "localhost"),
|
data/lib/ocular/dsl/fog.rb
CHANGED
@@ -6,6 +6,7 @@ class Ocular
|
|
6
6
|
module Fog
|
7
7
|
@@__aws_instance = nil
|
8
8
|
|
9
|
+
add_help "aws", "Returns Fog::Compute instance"
|
9
10
|
def aws()
|
10
11
|
if @@__aws_instance
|
11
12
|
return @@__aws_instance
|
@@ -20,6 +21,7 @@ class Ocular
|
|
20
21
|
return @@__aws_instance
|
21
22
|
end
|
22
23
|
|
24
|
+
add_help "autoscaling", "Returns Fog::AWS::AutoScaling instance"
|
23
25
|
def autoscaling()
|
24
26
|
return ::Fog::AWS::AutoScaling.new({
|
25
27
|
:aws_access_key_id => ::Ocular::Settings::get(:aws)[:aws_access_key_id],
|
@@ -27,6 +29,8 @@ class Ocular
|
|
27
29
|
})
|
28
30
|
end
|
29
31
|
|
32
|
+
|
33
|
+
add_help "find_servers_in_autoscaling_groups(substring)", "Returns instances in an autoscaling group which name matches substring"
|
30
34
|
def find_servers_in_autoscaling_groups(substring)
|
31
35
|
instances = []
|
32
36
|
for group in autoscaling.groups
|
data/lib/ocular/dsl/orbit.rb
CHANGED
@@ -5,11 +5,14 @@ class Ocular
|
|
5
5
|
module DSL
|
6
6
|
module Orbit
|
7
7
|
|
8
|
+
add_help "orbit", "Returns OrbitFunctions instance for accessing orbit control data"
|
9
|
+
|
8
10
|
class OrbitFunctions
|
9
11
|
def initialize(etcd)
|
10
12
|
@etcd = etcd
|
11
13
|
end
|
12
14
|
|
15
|
+
add_help "orbit::get_service_endpoints(service_name)", "Returns an array of ips running service_name"
|
13
16
|
def get_service_endpoints(service_name)
|
14
17
|
orbit_endpoints = []
|
15
18
|
endpoints = @etcd.get("/orbit/services/#{service_name}/endpoints").node.children
|
data/lib/ocular/dsl/ssh.rb
CHANGED
data/lib/ocular/version.rb
CHANGED