Skip to content

Commit

Permalink
Merge branch 'bjwatson-issue-1890'
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Jun 25, 2016
2 parents f6d654f + 6345edd commit f2fae7b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions gcloud/logging/_gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ def sink_create(self, project, sink_name, filter_, destination):
"""
options = None
parent = 'projects/%s' % (project,)
path = 'projects/%s/sinks/%s' % (project, sink_name)
sink_pb = LogSink(name=path, filter=filter_, destination=destination)
sink_pb = LogSink(name=sink_name, filter=filter_,
destination=destination)
try:
self._gax_api.create_sink(parent, sink_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
path = 'projects/%s/sinks/%s' % (project, sink_name)
raise Conflict(path)
raise

Expand Down Expand Up @@ -315,13 +316,13 @@ def metric_create(self, project, metric_name, filter_, description):
"""
options = None
parent = 'projects/%s' % (project,)
path = 'projects/%s/metrics/%s' % (project, metric_name)
metric_pb = LogMetric(name=path, filter=filter_,
metric_pb = LogMetric(name=metric_name, filter=filter_,
description=description)
try:
self._gax_api.create_log_metric(parent, metric_pb, options)
except GaxError as exc:
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
path = 'projects/%s/metrics/%s' % (project, metric_name)
raise Conflict(path)
raise

Expand Down
4 changes: 2 additions & 2 deletions gcloud/logging/test__gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def test_sink_create_ok(self):
gax_api._create_sink_called_with)
self.assertEqual(parent, self.PROJECT_PATH)
self.assertTrue(isinstance(sink, LogSink))
self.assertEqual(sink.name, self.SINK_PATH)
self.assertEqual(sink.name, self.SINK_NAME)
self.assertEqual(sink.filter, self.FILTER)
self.assertEqual(sink.destination, self.DESTINATION_URI)
self.assertEqual(options, None)
Expand Down Expand Up @@ -705,7 +705,7 @@ def test_metric_create_ok(self):
gax_api._create_log_metric_called_with)
self.assertEqual(parent, self.PROJECT_PATH)
self.assertTrue(isinstance(metric, LogMetric))
self.assertEqual(metric.name, self.METRIC_PATH)
self.assertEqual(metric.name, self.METRIC_NAME)
self.assertEqual(metric.filter, self.FILTER)
self.assertEqual(metric.description, self.DESCRIPTION)
self.assertEqual(options, None)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

GRPC_EXTRAS = [
'grpcio >= 0.14.0',
'google-gax >= 0.12.0',
'gax-google-pubsub-v1',
'gax-google-logging-v2',
'google-gax >= 0.12.1',
'gax-google-pubsub-v1 >= 0.7.10',
'gax-google-logging-v2 >= 0.7.10',
]

if sys.version_info[:2] == (2, 7) and 'READTHEDOCS' not in os.environ:
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ covercmd =
[grpc]
deps =
grpcio >= 0.14.0
google-gax >= 0.12.0
gax-google-pubsub-v1
gax-google-logging-v2
google-gax >= 0.12.1
gax-google-pubsub-v1 >= 0.7.10
gax-google-logging-v2 >= 0.7.10

[testenv:py27]
basepython =
Expand Down

0 comments on commit f2fae7b

Please sign in to comment.