# Copyright 2016 Canonical Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE(tinwood): This file needs to remain Python2 as it uses keystoneclient # from the payload software to do it's work. from __future__ import print_function import json import os import stat import sys import time from keystoneclient.v2_0 import client from keystoneclient.v3 import client as keystoneclient_v3 from keystoneclient.auth import token_endpoint from keystoneclient import session, exceptions import uds_comms as uds _usage = """This file is called from the keystone_utils.py file to implement various keystone calls and functions. It is called with one parameter which is the path to a Unix Domain Socket file. The messages passed to the this process from the keystone_utils.py includes the following keys: { 'path': The api path on the keystone manager object. 'api_version': the keystone API version to use. 'api_local_endpoint': the local endpoint to connect to. 'admin_token': the admin token to use with keystone. 'args': the non-keyword argument to supply to the keystone manager call. 'kwargs': any keyword args to supply to the keystone manager call. } The result of the call, or an error, is returned as a json encoded result in the same file that sent the arguments. { 'result': 'error':