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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yzk1YjNjYjNiZDg1YjU1MWYyNGQyZWNhMWY4MWU4MDgyNDllNDM2MQ==
4
+ ODUzNzJmODQxZWE1N2VjODk2MjJlYWIzMTcxOGMxOGE1NTdiYmY3Ng==
5
5
  data.tar.gz: !binary |-
6
- ZDFjNTE1NDA2N2M3YzYxYzllODIwZjE5MWMzZGM2ZjBkZjE5NDI0MQ==
6
+ ZDMzMTk2NDA0M2M1ZDMwZDA4NjliNDI1NTY4Yzc2MzBkYWZjMTY2NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzVhZDRjZmJkOTYyZTY3ZDgwZDRlODg0NWNkNmFjODRhZGZjYmUzMGMzNWVl
10
- YjUyMGJiZGZkOGY4YjJiZGI2NjJkNTdmZjIxNjM2NTFlOGNmZTc0YWI1NzI3
11
- NGY5NzY2ZWZkYzI1NzU5MWNmOGNlNTAyZGJkN2ZhNjY5MGNkZGQ=
9
+ N2Y2NWQ4MjA4Y2RjZGUzNjM2ZGZmOTI4MDE1MzE0MTBhNTQ2MjAwMWM1NzU0
10
+ YjgzYTRiNGU2NjAyMmZmMjNiMzg5MzE1ZjM2MjRmYTRkNmZmYWIxNzZjMWU1
11
+ MThlN2VjZGIwMTI5MDlmNjRmMGM0NjFkMzRhNzU3NGVkZmYxYTk=
12
12
  data.tar.gz: !binary |-
13
- ZTAxZTJjMGZiNGFkNDgzZTFiMmZmNTY3OGJkODdhZjQxZjIzYWFmYzhlOGY3
14
- NmIyMDJmYmFjOGVkYTE1ZGFhZjUxMDNhNmU5YmUzODNhNjQ5MjI2OTc0NGM1
15
- NDE5MmU1Njg1MmU3NTAxMDcwNmFlM2ViNTJiOTA2NDRhNWYwODg=
13
+ MzM2ZmQ2YjJiZjRmZjZhNmM1MjFkZTZhMjJiYjczMWEzYmQxMDJiOTFmZDkx
14
+ YWVjN2Q1NTI1YjdiNmZkZWIwYTA4ODgzMjVkMDdlYmFiOWIyNmNjM2E4ZDVh
15
+ ZDU3YzM5OTBmZGJmMzZkYzA5MWRmODUwMzZkYTc3M2ZjYzYwMjg=
@@ -1,46 +1,21 @@
1
1
  module LogsCfPlugin
2
2
  class LogTarget
3
- def initialize(target_organization, target_space, ids)
4
- raise ArgumentError, "Requires 3 ids" unless ids.size == 3
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
- !!target
8
+ !@app_id.nil?
19
9
  end
20
10
 
21
11
  def query_params
22
- case target
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
- return nil if ambiguous?
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
- guids = [client.current_organization.guid, client.current_space.guid, input[:app].try(:guid)]
19
+ app_id = input[:app].try(:guid)
22
20
 
23
- log_target = LogTarget.new(input[:org], input[:space], guids)
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])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logs-cf-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29.pre
4
+ version: 0.0.30.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal