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

added an option for https introspect #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion ist.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Default_Max_Width = 36
proxy = None
token = None
ssl_enable = False

ServiceMap = {
"vr": "contrail-vrouter-agent",
Expand All @@ -52,6 +53,8 @@ class Introspect:
def __init__ (self, host, port, filename):

self.host_url = "http://" + host + ":" + str(port) + "/"
if (ssl_enable):
self.host_url = "https://" + host + ":" + str(port) + "/"
self.filename = filename

def get (self, path):
Expand All @@ -76,7 +79,7 @@ def get (self, path):
headers['X-Auth-Token'] = token
if debug: print("DEBUG: retrieving url " + url)
try:
response = requests.get(url,headers=headers)
response = requests.get(url,headers=headers, verify=False)
response.raise_for_status()
except requests.exceptions.HTTPError:
print('The server couldn\'t fulfill the request.')
Expand Down Expand Up @@ -2000,6 +2003,10 @@ def main():
if '--debug' in argv:
debug = True

global ssl_enable
if '--ssl-enable' in argv:
ssl_enable = True

parser = argparse.ArgumentParser(prog='ist',
description='A script to make Contrail Introspect output CLI friendly.')
parser.add_argument('--version', action="store_true", help="Script version")
Expand All @@ -2009,6 +2016,7 @@ def main():
parser.add_argument('--proxy', type=str, help="Introspect proxy URL")
parser.add_argument('--token', type=str, help="Token for introspect proxy requests")
parser.add_argument('--file', type=str, help="Introspect file")
parser.add_argument('--ssl-enable', action="store_true", help="used when ssl is enabled on intropect url")

roleparsers = parser.add_subparsers()

Expand Down