コード例 #1
0
def verify_int_var():
    actualoutput = automationassets.get_automation_variable(IntVariableName)
    if actualoutput == expectedIntVariableValue:
        print "Get UnEncrypted Variable Successful - Int"
    else:
        print "ERROR: Get UnEncrypted Variable Failed - Int"
    
    updatedintvariableval = 99000
    automationassets.set_automation_variable(IntVariableName, updatedintvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(IntVariableName)
    if actualoutput == updatedintvariableval:
        print "Update UnEncrypted Variable Successful - Int"
    else:
        print "ERROR: Update UnEncrypted Variable Failed - Int"

    automationassets.set_automation_variable(IntVariableName, expectedIntVariableValue)
コード例 #2
0
def verify_bool_var():
    actualoutput = automationassets.get_automation_variable(BoolVariableName)
    if actualoutput == expectedBoolVariableValue:
        print "Get UnEncrypted Variable Successful - Bool"
    else:
        print "ERROR: Get UnEncrypted Variable Failed - Bool"
    
    updatedboolvariableval = True
    automationassets.set_automation_variable(BoolVariableName, updatedboolvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(BoolVariableName)
    if actualoutput == updatedboolvariableval:
        print "Update UnEncrypted Variable Successful - Bool"
    else:
        print "ERROR: Update UnEncrypted Variable Failed - Bool"

    automationassets.set_automation_variable(BoolVariableName, expectedBoolVariableValue)    
コード例 #3
0
def verify_enc_unspecified_var():
    actualoutput = automationassets.get_automation_variable(UnspecifiedVariableNameEn)
    if actualoutput == ExpectedUnspecifiedVariableValEn:
        print "Get Encrypted Variable Successful - Unspecified"
    else:
        print "ERROR: Get Encrypted Variable Failed - Unspecified"
    
    updatedunspecifiedvariableval = "Enc Unspecified value updated"
    automationassets.set_automation_variable(UnspecifiedVariableNameEn, updatedunspecifiedvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(UnspecifiedVariableNameEn)
    if actualoutput == updatedunspecifiedvariableval:
        print "Update Encrypted Variable Successful - Unspecified"
    else:
        print "ERROR: Update Encrypted Variable Failed - Unspecified"

    automationassets.set_automation_variable(UnspecifiedVariableNameEn, ExpectedUnspecifiedVariableValEn)
コード例 #4
0
def verify_string_var():
    actualoutput = automationassets.get_automation_variable(StringVariableName)
    if actualoutput == expectedStringVariableValueUnEn:
        print "Get UnEncrypted Variable Successful - String"
    else:
        print "ERROR: Get UnEncrypted Variable Failed - String"
    
    updatedstrvariableval = "Updated string variable value"
    automationassets.set_automation_variable(StringVariableName, updatedstrvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(StringVariableName)
    if actualoutput == updatedstrvariableval:
        print "Update UnEncrypted Variable Successful - String"
    else:
        print "ERROR: Update UnEncrypted Variable Failed - String"

    automationassets.set_automation_variable(StringVariableName, expectedStringVariableValueUnEn)
コード例 #5
0
def verify_enc_bool_var():
    actualoutput = automationassets.get_automation_variable(BoolVariableNameEn)
    if actualoutput == ExpectedBoolVariableValEn:
        print "Get Encrypted Variable Successful - Bool"
    else:
        print "ERROR: Get Encrypted Variable Failed - Bool"
    
    updatedboolvariableval = False
    automationassets.set_automation_variable(BoolVariableNameEn, updatedboolvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(BoolVariableNameEn)
    if actualoutput == updatedboolvariableval:
        print "Update Encrypted Variable Successful - Bool"
    else:
        print "ERROR: Update Encrypted Variable Failed - Bool"

    automationassets.set_automation_variable(BoolVariableNameEn, ExpectedBoolVariableValEn)
コード例 #6
0
def verify_enc_int_var():
    actualoutput = automationassets.get_automation_variable(IntVariableNameEn)
    if actualoutput == ExpectedIntVariableValEn:
        print "Get Encrypted Variable Successful - Int"
    else:
        print "ERROR: Get Encrypted Variable Failed - Int"
    
    updatedintvariableval = 8877
    automationassets.set_automation_variable(IntVariableNameEn, updatedintvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(IntVariableNameEn)
    if actualoutput == updatedintvariableval:
        print "Update Encrypted Variable Successful - Int"
    else:
        print "ERROR: Update Encrypted Variable Failed - Int"

    automationassets.set_automation_variable(IntVariableNameEn, ExpectedIntVariableValEn)
コード例 #7
0
def verify_unspecified_var():
    actualoutput = automationassets.get_automation_variable(UnspecifiedVariableName)
    if actualoutput == expectedUnspecifiedVariableValue:
        print "Get UnEncrypted Variable Successful - Unspecified"
    else:
        print "ERROR: Get UnEncrypted Variable Failed - Unspecified"
    
    updatedunspecifiedvariableval = "Updated unspecified variable"
    automationassets.set_automation_variable(UnspecifiedVariableName, updatedunspecifiedvariableval)
    time.sleep(60)

    actualoutput = automationassets.get_automation_variable(UnspecifiedVariableName)
    if actualoutput == updatedunspecifiedvariableval:
        print "Update UnEncrypted Variable Successful - Unspecified"
    else:
        print "ERROR: Update UnEncrypted Variable Failed - Unspecified"

    automationassets.set_automation_variable(UnspecifiedVariableName, expectedUnspecifiedVariableValue)    
コード例 #8
0
def sendMail(to, sbjct, msg=" "):
    bdy = """
    {
        "TO":"%s",
        "Subject":"%s",
        "Body":"%s"
    }""" % to, sbjct, msg
    requests.post(
        automationassets.get_automation_variable('EmailRestEndpoint'),
        data=bdy)
コード例 #9
0
logging.basicConfig(
    format='%(asctime)s %(name)-20s %(levelname)-5s %(message)s',
    level=logging.INFO)

logging.info(sys.version)
logging.info("%s - Starting" % datetime.datetime.now())
logging.info("INPUT: %s" % sys.argv)

#try:
prsArg = json.loads(json.loads(sys.argv[1])['RequestBody'])
print(prsArg)
newCompartmentName = prsArg['subname']
newCompartmentOwner = prsArg['owner']
newCompartmentBudget = float(prsArg['monthlybudget'])

storage_account = automationassets.get_automation_variable(
    'oci_storage_account')
storage_share = automationassets.get_automation_variable(
    'oci_storage_share_name')

automationConnection = automationassets.get_automation_connection(
    "AzureRunAsConnection")
AZTenantId = automationConnection["TenantId"]

logging.info("Getting OCI config files from file share - account: %s " %
             storage_account)
file_service = FileService(
    account_name=storage_account,
    account_key=automationassets.get_automation_variable(
        'oci_storage_account_key'))

# Create target Directory if don't exist
コード例 #10
0
if Jira is None:
    Jira = input("JiraNum: ")

#Strip APM name for whitespaces
API = API.strip()
#Convert to UpperCase
API = API.upper()

print("\n\n--Echoing Args--\n\n")

print('APM : ' + API)
print('\nChangeLog: ' + ChangeLog)
print('\nUserName: '******'\nJiraNum: ' + Jira)

APIKey = automationassets.get_automation_variable("NR_Key")
APIID = 0
match = 0
PageCount = 1  #Number of pages from API
count = 200  #Records per page for Loop termination
uri = 'https://api.newrelic.com/v2/applications.json?page='

#API Key Below
headers = {'X-Api-Key': APIKey, 'Content-type': 'application/json'}
while (match == 0 and count == 200):
    count = 0
    finaluri = uri + PageCount.__str__()
    req = requests.get(finaluri, headers=headers)
    var = json.loads(req.content)
    svar = var["applications"]
    for item in svar:
コード例 #11
0
logging.basicConfig(
    format='%(asctime)s %(name)-20s %(levelname)-5s %(message)s',
    level=logging.INFO)

logging.info(sys.version)
logging.info("%s - Starting" % datetime.datetime.now())
logging.info("INPUT: %s" % sys.argv)

#try:
prsArg = json.loads(json.loads(sys.argv[1])['RequestBody'])
print(prsArg)
newCompartmentName = prsArg['subname']
newCompartmentOwner = prsArg['owner']
newCompartmentBudget = float(prsArg['monthlybudget'])

storage_account = automationassets.get_automation_variable(
    'oci_storage_account')
storage_share = automationassets.get_automation_variable(
    'oci_storage_share_name')

AZTenantId = "78820852-55fa-450b-908d-45c0d911e76b"

logging.info("Getting OCI config files from file share - account: %s " %
             storage_account)
file_service = FileService(
    account_name=storage_account,
    account_key=automationassets.get_automation_variable(
        'oci_storage_account_key'))

# Create target Directory if don't exist
if not os.path.exists('.oci'):
    os.mkdir('.oci')