Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't start relogin thread if login fails. #314

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions acitoolkit/acisession.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ def login(self, timeout=None):
resp = requests.Response()
resp.status_code = 404
resp._content = '{"error": "Could not relogin to APIC due to ConnectionError"}'
return resp
if (self.appcenter_user and self._subscription_enabled) or not self.cert_auth:
self.login_thread.daemon = True
self.login_thread.start()
Expand Down
42 changes: 37 additions & 5 deletions applications/lint/acilint.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def warning_010(self):
"""
provide_db = {}
for tenant in self.tenants:
# TODO: Need code to deal with imported contracts.
for app in tenant.get_children(AppProfile):
for epg in app.get_children(EPG):
if epg.has_bd():
Expand All @@ -231,6 +232,16 @@ def warning_010(self):
provide_db[tenant.name][contract.name] = []
if context.name not in provide_db[tenant.name][contract.name]:
provide_db[tenant.name][contract.name].append(context.name)
for l3out in tenant.get_children(OutsideL3):
for epg in l3out.get_children(OutsideEPG):
provided = epg.get_all_provided()
for contract in provided:
if tenant.name not in provide_db:
provide_db[tenant.name] = {}
if contract.name not in provide_db[tenant.name]:
provide_db[tenant.name][contract.name] = []
if context.name not in provide_db[tenant.name][contract.name]:
provide_db[tenant.name][contract.name].append(context.name)

for tenant in self.tenants:
if tenant.name not in provide_db:
Expand All @@ -248,14 +259,34 @@ def warning_010(self):
context = bd.get_context()
consumed = epg.get_all_consumed()
for contract in consumed:
if contract.name not in provide_db[tenant.name]:
if contract.name in provide_db[tenant.name]:
if context.name not in provide_db[tenant.name][contract.name]:
self.output_handler("Warning 010: Contract '%s' not provided in context '%s' "
"where it is being consumed for"
" tenant '%s'" % (contract.name, context.name, tenant.name))
elif (tenant.name != 'common') and (contract.name in provide_db['common']):
if context.name not in provide_db['common'][contract.name]:
self.output_handler("Warning 010: Contract '%s' not provided in context '%s' "
"where it is being consumed for"
" tenant '%s'" % (contract.name, context.name, tenant.name))
elif tenant.name == 'common':
self.output_handler("Warning 010: Contract '%s' not provided "
"within the same tenant "
"'%s'" % (contract.name, tenant.name))
elif context.name not in provide_db[tenant.name][contract.name]:
self.output_handler("Warning 010: Contract '%s' not provided in context '%s' "
"where it is being consumed for"
" tenant '%s'" % (contract.name, context.name, tenant.name))
else:
self.output_handler("Warning 010: Contract '%s' not provided "
"within the same tenant "
"'%s' or 'common'" % (contract.name, tenant.name))
#if contract.name not in provide_db[tenant.name].keys() + provide_db['common'].keys():
# self.output_handler("Warning 010: Contract '%s' not provided "
# "within the same tenant "
# "'%s'" % (contract.name, tenant.name))
##elif context.name not in provide_db[tenant.name][contract.name] + provide_db['common'][contract.name]:
#elif (contract.name in provide_db[tenant.name] and context.name not in provide_db[tenant.name][contract.name]) \
# or (contract.name in provide_db['common'] and context.name not in provide_db['common'][contract.name]):
# self.output_handler("Warning 010: Contract '%s' not provided in context '%s' "
# "where it is being consumed for"
# " tenant '%s'" % (contract.name, context.name, tenant.name))

@staticmethod
def subj_matches_proto(filterlist, protocol):
Expand Down Expand Up @@ -393,6 +424,7 @@ def warning_014(self):
self.output_handler("Warning 014: In tenant '%s' contract "
"'%s' subject '%s' has no Filters." % (
tenant.name, contract.name, subject.name))
missing_filter = False

def error_001(self):
"""
Expand Down