added: fuel token auth

This commit is contained in:
Aleksandr Dobdin 2016-09-02 12:59:33 +00:00
parent 3ce28ab89c
commit 721cb4f97b
4 changed files with 8 additions and 2 deletions

View File

@ -50,6 +50,7 @@ def parse_args():
parser.add_argument('--fuel-ip', help='fuel ip address')
parser.add_argument('--fuel-user', help='fuel username')
parser.add_argument('--fuel-pass', help='fuel password')
parser.add_argument('--fuel-token', help='fuel auth token')
parser.add_argument('-o', '--dest-file',
help=('Output filename for the archive in tar.gz'
' format for command outputs and collected'
@ -215,6 +216,9 @@ def main(argv=None):
conf['fuel_user'] = args.fuel_user
if args.fuel_pass:
conf['fuel_pass'] = args.fuel_pass
if args.fuel_token:
conf['fuel_api_token'] = args.fuel_token
conf['fuelclient'] = False
if args.fuel_proxy:
conf['fuel_skip_proxy'] = False
if args.put or args.command or args.script or args.get:

View File

@ -33,6 +33,7 @@ def load_conf(filename):
conf['fuel_ip'] = '127.0.0.1'
conf['fuel_api_user'] = 'admin'
conf['fuel_api_pass'] = 'admin'
conf['fuel_api_token'] = None
conf['fuel_api_tenant'] = 'admin'
conf['fuel_api_port'] = '8000'
conf['fuel_api_keystone_port'] = '5000'

View File

@ -16,7 +16,7 @@
# under the License.
project_name = 'timmy'
version = '1.17.7'
version = '1.18.0'
if __name__ == '__main__':
import sys

View File

@ -531,7 +531,7 @@ class NodeManager(object):
if self.conf['rqfile']:
self.import_rq()
self.nodes = {}
self.token = None
self.token = self.conf['fuel_api_token']
self.fuel_init()
# save os environment variables
environ = os.environ
@ -779,6 +779,7 @@ class NodeManager(object):
'''Get keystone token to access Nailgun API. Requires Fuel 5+'''
if self.token:
return True
self.logger.info('getting token for Nailgun')
v2_body = ('{"auth": {"tenantName": "%s", "passwordCredentials": {'
'"username": "%s", "password": "%s"}}}')
# v3 not fully implemented yet