Fix undefined variables, basestring usage, and some associated python3 issues

This commit is contained in:
Toshio Kuratomi 2017-07-22 18:15:46 -07:00
commit 225fa5d092
84 changed files with 652 additions and 963 deletions

View file

@ -49,14 +49,16 @@ This script has been inspired by the cobbler.py inventory. thanks
Author: Damien Garros (@dgarros)
Version: 0.2.0
"""
import json
import os
import argparse
import re
import sys
try:
import json
import argparse
HAS_ARGPARSE = True
except ImportError:
import simplejson as json
HAS_ARGPARSE = False
try:
from apstra.aosom.session import Session
@ -292,6 +294,8 @@ class AosInventory(object):
if not HAS_AOS_PYEZ:
raise Exception('aos-pyez is not installed. Please see details here: https://github.com/Apstra/aos-pyez')
if not HAS_ARGPARSE:
raise Exception('argparse is not installed. Please install the argparse library or upgrade to python-2.7')
# Initialize inventory
self.inventory = dict() # A list of groups and the hosts in that group