Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path "mysink" did not match expected pattern #1817

Closed
waprin opened this issue May 23, 2016 · 4 comments
Closed

path "mysink" did not match expected pattern #1817

waprin opened this issue May 23, 2016 · 4 comments
Assignees
Labels
api: logging Issues related to the Cloud Logging API.

Comments

@waprin
Copy link
Contributor

waprin commented May 23, 2016

Looks like the Sink resource name is not the fully qualified version. Docs agree: https://cloud.google.com/logging/docs/api/ref_v2beta1/rest/v2beta1/projects.sinks#resource-logsink. I don't see a good reason why it wouldn't be the full name. Once again, I will bug people but for now I think we should disable the validation.

 {u'filter': u'logName=projects/bill-stackdriver-experiment/logs/syslog AND severity>=ERROR', u'destination': u'storage.googleapis.com/bill-new-stackdriver', u'name': u'mysink', u'outputVersionFormat': u'V2'} 
Validating sink name mysink bill-stackdriver-experiment 
Traceback (most recent call last):
  File "export.py", line 102, in <module>
    main(args.project_id, args.destination_bucket)
  File "export.py", line 84, in main
    list_sinks(client)
  File "export.py", line 54, in list_sinks
    sinks = client.list_sinks()[0]
  File "/Users/waprin/.virtualenvs/docsamples10/lib/python2.7/site-packages/gcloud/logging/client.py", line 196, in list_sinks
    for resource in resp.get('sinks', ())]
  File "/Users/waprin/.virtualenvs/docsamples10/lib/python2.7/site-packages/gcloud/logging/sink.py", line 112, in from_api_repr
    sink_name = _sink_name_from_path(resource['name'], client.project)
  File "/Users/waprin/.virtualenvs/docsamples10/lib/python2.7/site-packages/gcloud/logging/sink.py", line 45, in _sink_name_from_path
    return _name_from_project_path(path, project, _SINK_TEMPLATE)
  File "/Users/waprin/.virtualenvs/docsamples10/lib/python2.7/site-packages/gcloud/_helpers.py", line 458, in _name_from_project_path
    path, template.pattern,))
ValueError: path "mysink" did not match expected pattern "
    projects/            # static prefix
    (?P<project>[^/]+)   # initial letter, wordchars + hyphen
    /sinks/              # static midfix
    (?P<name>[^/]+)      # initial letter, wordchars + allowed punc
@dhermes dhermes added the api: logging Issues related to the Cloud Logging API. label May 25, 2016
@dhermes
Copy link
Contributor

dhermes commented May 25, 2016

Same idea as #1808?

@waprin
Copy link
Contributor Author

waprin commented May 25, 2016

Yep, except it will never get fixed because they don't consider it important enough to change the API for.

@tseaver
Copy link
Contributor

tseaver commented May 26, 2016

@waprin Thanks for the report! 61004b7 made a similar change for metrics: we are missing the system test for list_sinks which would have surfaced this issue.

@tseaver
Copy link
Contributor

tseaver commented May 26, 2016

This is different than #1808, because the Sink resource as documented doesn't have the fully-qualified path in name. I already made a similar change (61004b7) for Metric.from_api_repr, and added a system test for Client.lists_metrics which exercised it against real server-generated data. #1825 makes the parallel change for sinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API.
Projects
None yet
Development

No branches or pull requests

3 participants