Merge "Fix cron-triggers and openstack actions"

This commit is contained in:
Jenkins 2017-07-31 12:27:26 +00:00 committed by Gerrit Code Review
commit 212119dcfc
3 changed files with 9 additions and 11 deletions

View File

@ -85,15 +85,7 @@ def delete_trust(trust_id):
if not trust_id:
return
ctx = auth_ctx.ctx()
# If this trust is already in the context then it means that
# context already has trust scoped token from exactly this trust_id.
# So we don't need request the token from the trust one more time.
if ctx.is_trust_scoped and ctx.trust_id == trust_id:
keystone_client = keystone.client()
else:
keystone_client = keystone.client_for_trusts(trust_id)
keystone_client = keystone.client_for_trusts(trust_id)
try:
keystone_client.trusts.delete(trust_id)

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from mistral import context as auth_context
from mistral import exceptions
from mistral.tests.unit import base
@ -44,7 +46,10 @@ class KeystoneUtilsTest(base.BaseTest):
keystone.format_url(url_template, self.values)
)
def test_get_endpoint_for_project_noauth(self):
@mock.patch.object(keystone, 'client')
def test_get_endpoint_for_project_noauth(self, client):
client().tokens.get_token_data.return_value = {'token': None}
# service_catalog is not set by default.
auth_context.set_ctx(base.get_context())
self.addCleanup(auth_context.set_ctx, None)

View File

@ -200,7 +200,8 @@ def obtain_service_catalog(ctx):
response = ctx.service_catalog
# Target service catalog may not be passed via API.
if not response and ctx.is_target:
# If we don't have the catalog yet, it should be requested.
if not response:
response = client().tokens.get_token_data(
token,
include_catalog=True