tail-cf-plugin 0.0.9.pre → 0.0.10.pre
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,27 +3,40 @@ require 'faye/websocket'
|
|
3
3
|
require 'eventmachine'
|
4
4
|
|
5
5
|
module TailCfPlugin
|
6
|
-
require 'tail-cf-plugin/
|
6
|
+
require 'tail-cf-plugin/loggregator_client'
|
7
7
|
require 'log_message/log_message.pb'
|
8
8
|
|
9
9
|
class Plugin < CF::CLI
|
10
10
|
include LoginRequirements
|
11
11
|
|
12
|
-
desc "Tail
|
12
|
+
desc "Tail logs for CF applications or spaces"
|
13
13
|
group :apps
|
14
|
-
input :loggregator_host, :argument => :required, :desc => "The ip:port of the loggregator"
|
15
14
|
input :app, :desc => "App to tail logs from", :argument => :optional, :from_given => by_name(:app)
|
16
|
-
input :space, :desc => "
|
15
|
+
input :space, :type => :boolean, :desc => "Logs of all apps in the current space", :default => false
|
17
16
|
|
18
17
|
def tail
|
18
|
+
if input[:space]
|
19
|
+
app_guid = nil
|
20
|
+
else
|
21
|
+
unless input[:app]
|
22
|
+
Mothership::Help.command_help(@@commands[:tail])
|
23
|
+
fail "Please provide an application to log or call with --space"
|
24
|
+
end
|
25
|
+
app_guid = input[:app].guid
|
26
|
+
end
|
19
27
|
|
20
|
-
|
28
|
+
loggregator_client = LoggregatorClient.new(STDOUT)
|
29
|
+
loggregator_client.listen(loggregator_host, client.current_space.guid, app_guid, client.token.auth_header)
|
30
|
+
end
|
31
|
+
|
32
|
+
::ManifestsPlugin.default_to_app_from_manifest(:tail, false)
|
21
33
|
|
22
|
-
|
23
|
-
app_guid = input[:app] && input[:app].guid
|
34
|
+
private
|
24
35
|
|
25
|
-
|
26
|
-
|
36
|
+
def loggregator_host
|
37
|
+
target_base = client.target.sub(/^https?:\/\/([^\.]+\.)?(.+)\/?/, '\2')
|
38
|
+
"loggregator.#{target_base}"
|
27
39
|
end
|
40
|
+
|
28
41
|
end
|
29
42
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tail-cf-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.10.pre
|
5
|
+
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Pivotal
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cf
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.2.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.2.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: faye-websocket
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- lib/tail-cf-plugin/
|
69
|
+
- lib/tail-cf-plugin/loggregator_client.rb
|
70
70
|
- lib/tail-cf-plugin/plugin.rb
|
71
71
|
- vendor/log_message/log_message.pb.rb
|
72
72
|
- vendor/log_message/log_message.proto
|