Fix credentials for force_cleanup, fix issue loading openrc variables from env with identity API v2

Change-Id: Ie97dac1ebd97f6f9ec90f04f75c2e88937c45678
This commit is contained in:
ahothan 2017-05-26 08:07:30 -07:00
parent 3e0531a436
commit 4b66bf34d9
2 changed files with 5 additions and 4 deletions

View File

@ -96,7 +96,7 @@ class Credentials(object):
# Read a openrc file and take care of the password # Read a openrc file and take care of the password
# The 2 args are passed from the command line and can be None # The 2 args are passed from the command line and can be None
# #
def __init__(self, openrc_file, pwd, no_env): def __init__(self, openrc_file, pwd=None, no_env=False):
self.rc_password = None self.rc_password = None
self.rc_username = None self.rc_username = None
self.rc_tenant_name = None self.rc_tenant_name = None
@ -106,7 +106,7 @@ class Credentials(object):
self.rc_user_domain_name = None self.rc_user_domain_name = None
self.rc_project_domain_name = None self.rc_project_domain_name = None
self.rc_project_name = None self.rc_project_name = None
self.rc_identity_api_version = '2' self.rc_identity_api_version = 2
success = True success = True
if openrc_file: if openrc_file:

View File

@ -53,6 +53,7 @@ import argparse
import re import re
import sys import sys
import time import time
import traceback
# openstack python clients # openstack python clients
import cinderclient import cinderclient
@ -81,6 +82,7 @@ def fetch_resources(fetcher, options=None):
res_list = fetcher() res_list = fetcher()
except Exception as e: except Exception as e:
res_list = [] res_list = []
traceback.print_exc()
print "Warning exception while listing resources:" + str(e) print "Warning exception while listing resources:" + str(e)
resources = {} resources = {}
for res in res_list: for res in res_list:
@ -468,8 +470,7 @@ class KbCleaners(object):
def __init__(self, creds_obj, resources, dryrun): def __init__(self, creds_obj, resources, dryrun):
self.cleaners = [] self.cleaners = []
creds = creds_obj.get_credentials() sess = creds_obj.get_session()
sess = creds.get_session()
for cleaner_type in [StorageCleaner, ComputeCleaner, NetworkCleaner, KeystoneCleaner]: for cleaner_type in [StorageCleaner, ComputeCleaner, NetworkCleaner, KeystoneCleaner]:
self.cleaners.append(cleaner_type(sess, resources, dryrun)) self.cleaners.append(cleaner_type(sess, resources, dryrun))