Exemple #1
0
	)
parser.add_argument("-p", "--parameters", metavar="ParametersFile", help="JSON file where parameters are stored.", default="Parameters.json")
args = parser.parse_args()
ParametersFile = args.parameters

WebUser = args.user
WebKeyFile = os.path.expanduser(args.key)
TunnelUser = args.tunneluser
TunnelKeyFile = os.path.expanduser(args.tunnelkey)

# FInd Home Folder of user
HomeFolder = os.path.expanduser('~')


# Load in Passwords from protected file.
ParameterData = onevizion.GetParameters(ParametersFile)

ServerListRequest = onevizion.Trackor(trackorType = 'server', paramToken = 'trackor.onevizion.com')
ServerListRequest.read(
		filters={
			'VQS_SVR_LOCATION':'AWS',
			'EC2_PRIVATE_DNS':'not null'
			}, 
		fields=[
			'TRACKOR_KEY',
			'EC2_PRIVATE_IP',
			'EC2_PRIVATE_DNS',
			'EC2_CLIENT_TAG'
			]
		)
if len(ServerListRequest.errors) > 0:
import onevizion

# Having a parameters file is just an easy way to not have you passwords stored in a script
PasswordData = onevizion.GetParameters('Parameters.json')
# This enables some automatic messaging within the onveizion library.  Can be 0, 1, or 2.  the higher the number, the more messages you get.
onevizion.Config["Verbosity"] = 1

#Let's create some Trackor object for later use in the script
#Trackor object to get a list of Needed "Casees"
CaseRequest = onevizion.Trackor(
    trackorType='Case',
    URL='trackor.onevizion.com',
    userName=PasswordData["trackor.onevizion.com"]["UserName"],
    password=PasswordData["trackor.onevizion.com"]["Password"])
#Trackor object to pull individual "Cases" from Production
CasePuller = onevizion.Trackor(
    trackorType='Case',
    URL='trackor.onevizion.com',
    userName=PasswordData["trackor.onevizion.com"]["UserName"],
    password=PasswordData["trackor.onevizion.com"]["Password"])
#Trackor object to Push "Cases" into UAT
CaseMaker = onevizion.Trackor(
    trackorType='Case',
    URL='uat-trackor.onevizion.com',
    userName=PasswordData["uat-trackor.onevizion.com"]["UserName"],
    password=PasswordData["uat-trackor.onevizion.com"]["Password"])

# Since some of the fields are EFiles, let's first get a list, then do the records one at a time to
# reduce the memory required for the total transfer and reduce the chances of failure.
CaseRequest.read(
    search=
Exemple #3
0
                    metavar="PasswordsFile",
                    help="JSON file where passwords are stored.",
                    default="Passwords.json")
parser.add_argument(
    "-v",
    "--verbose",
    action='count',
    default=0,
    help=
    "Print extra debug messages and save to a file. Attach file to email if sent."
)
parser.add_argument("-w", "--website", help="website name.")
args = parser.parse_args()
PasswordsFile = args.passwords

parameters = onevizion.GetParameters(PasswordsFile)
onevizion.Config["Verbosity"] = args.verbose
onevizion.Config["SMTPToken"] = "SMTP"
Message = onevizion.Message
Trace = onevizion.Config["Trace"]

PDError = (onevizion.CheckPasswords(
    parameters, 'SMTP',
    ['Server', 'Port', 'UserName', 'Password', 'To']), ",\n",
           onevizion.CheckPasswords(
               parameters, 'SFTP',
               ['Url', 'UserName', 'Directory', 'KeyFile']))
if len(PDError) > 3:
    print(PDError)
    quit()
Exemple #4
0
import asyncio
import aiohttp
import onevizion

onevizion.Config["Verbosity"] = 1

ParameterData = onevizion.GetParameters('Parameters.json')

Message = onevizion.Message

async def GetExport(URL,userName,password,paramToken,trackorType,filters,fields,exportMode='CSV',delivery='File',waitPeriod=15):
	CSVText = None
	Exp = onevizion.Export(
		URL=URL,
		userName=userName,
		password=password,
		paramToken=paramToken,
		trackorType=trackorType,
		filters=filters,
		fields=fields,
		exportMode=exportMode,
		delivery=delivery
		)
	if len(Exp.errors) == 0:
		Message("Export Started. ProcessID: {ProcID}  Status: '{Status}'".format(ProcID=Exp.processId,Status=Exp.status),1)
		# Wait for Export to complete, poling every 60 seconds
		while Exp.status in ('PENDING', 'IN_QUEUE', 'RUNNING'):
			await asyncio.sleep(waitPeriod)
			Exp.getProcessStatus()
			Message("Export status is '{Status}' for ProcessID: {ProcID}".format(Status=Exp.status,ProcID=Exp.processId),1)
		if Exp.status not in ('EXECUTED','EXECUTED_WITHOUT_ERRORS'):
Exemple #5
0
    "Print extra debug messages and save to a file. Attach file to email if sent."
)
parser.add_argument("-p",
                    "--parameters",
                    metavar="ParametersFile",
                    help="JSON file where parameters are stored.",
                    default="Parameters.json")
args = parser.parse_args()
ParamtersFile = args.parameters
ThisVersion = args.version
CurrentVersion = args.currentversion

#Set some standard OneVizion Parameters
onevizion.Config["Verbosity"] = args.verbose
onevizion.Config["SMTPToken"] = "SMTP"
Params = onevizion.GetParameters(ParamtersFile)
Message = onevizion.Message
Trace = onevizion.Config["Trace"]


def VersionSplit(ThisVersion):
    """ 
	Splits up a String Version number (e.g: '8.59.10') into a numerical array for numeric sorting.
	"""
    VersionBreak = ThisVersion.split(".")
    VersionParts = []
    VersionParts.append(int(VersionBreak[0]))
    VersionParts.append(int(VersionBreak[1]))
    RelVer = VersionBreak[2].split('-RC')
    VersionParts.append(int(RelVer[0]))
    if len(RelVer) == 2: