logs-cf-plugin 0.0.29.pre → 0.0.30.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/logs-cf-plugin/log_target.rb +5 -30
- data/lib/logs-cf-plugin/plugin.rb +2 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODUzNzJmODQxZWE1N2VjODk2MjJlYWIzMTcxOGMxOGE1NTdiYmY3Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDMzMTk2NDA0M2M1ZDMwZDA4NjliNDI1NTY4Yzc2MzBkYWZjMTY2NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2Y2NWQ4MjA4Y2RjZGUzNjM2ZGZmOTI4MDE1MzE0MTBhNTQ2MjAwMWM1NzU0
|
10
|
+
YjgzYTRiNGU2NjAyMmZmMjNiMzg5MzE1ZjM2MjRmYTRkNmZmYWIxNzZjMWU1
|
11
|
+
MThlN2VjZGIwMTI5MDlmNjRmMGM0NjFkMzRhNzU3NGVkZmYxYTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzM2ZmQ2YjJiZjRmZjZhNmM1MjFkZTZhMjJiYjczMWEzYmQxMDJiOTFmZDkx
|
14
|
+
YWVjN2Q1NTI1YjdiNmZkZWIwYTA4ODgzMjVkMDdlYmFiOWIyNmNjM2E4ZDVh
|
15
|
+
ZDU3YzM5OTBmZGJmMzZkYzA5MWRmODUwMzZkYTc3M2ZjYzYwMjg=
|
@@ -1,46 +1,21 @@
|
|
1
1
|
module LogsCfPlugin
|
2
2
|
class LogTarget
|
3
|
-
def initialize(
|
4
|
-
|
5
|
-
@target_organization = target_organization
|
6
|
-
@target_space = target_space
|
7
|
-
|
8
|
-
@org_id = ids[0]
|
9
|
-
@space_id = ids[1]
|
10
|
-
@app_id = ids[2]
|
11
|
-
end
|
12
|
-
|
13
|
-
def ambiguous?
|
14
|
-
@target_organization && @target_space
|
3
|
+
def initialize(app_id)
|
4
|
+
@app_id = app_id
|
15
5
|
end
|
16
6
|
|
17
7
|
def valid?
|
18
|
-
|
8
|
+
!@app_id.nil?
|
19
9
|
end
|
20
10
|
|
21
11
|
def query_params
|
22
|
-
|
23
|
-
when :org
|
24
|
-
{org: @org_id}
|
25
|
-
when :space
|
26
|
-
{org: @org_id, space: @space_id}
|
27
|
-
when :app
|
28
|
-
{org: @org_id, space: @space_id, app: @app_id}
|
29
|
-
end
|
12
|
+
{app: @app_id}
|
30
13
|
end
|
31
14
|
|
32
15
|
private
|
33
16
|
|
34
17
|
def target
|
35
|
-
|
36
|
-
case
|
37
|
-
when @target_organization
|
38
|
-
:org
|
39
|
-
when @target_space
|
40
|
-
:space
|
41
|
-
when @app_id
|
42
|
-
:app
|
43
|
-
end
|
18
|
+
:app if @app_id
|
44
19
|
end
|
45
20
|
end
|
46
21
|
end
|
@@ -12,20 +12,13 @@ module LogsCfPlugin
|
|
12
12
|
desc "Tail or dump logs for CF applications or spaces"
|
13
13
|
group :apps
|
14
14
|
input :app, :desc => "App to tail logs from", :argument => :optional, :from_given => by_name(:app)
|
15
|
-
input :space, :type => :boolean, :desc => "Logs of all apps in the current space", :default => false
|
16
|
-
input :org, :type => :boolean, :desc => "Logs of all apps and spaces in the current organization", :default => false
|
17
15
|
input :recent, :type => :boolean, :desc => "Dump recent logs instead of tailing", :default => false
|
18
16
|
|
19
17
|
def logs
|
20
18
|
client.current_organization.name # resolve org name so CC will validate AuthToken
|
21
|
-
|
19
|
+
app_id = input[:app].try(:guid)
|
22
20
|
|
23
|
-
log_target = LogTarget.new(
|
24
|
-
|
25
|
-
if log_target.ambiguous?
|
26
|
-
Mothership::Help.command_help(@@commands[:logs])
|
27
|
-
fail "Please provide either --space or --org, but not both."
|
28
|
-
end
|
21
|
+
log_target = LogTarget.new(app_id)
|
29
22
|
|
30
23
|
unless log_target.valid?
|
31
24
|
Mothership::Help.command_help(@@commands[:logs])
|