Exemple #1
0
def get_ver_string(filename, manufacturing):
    try:
        file = open(filename, "r")
    except IOError:
        return "unknown version"

    ver_string = "unknown version"
    supports_cr = False
    # I really hate these checks
    supports_5050L = False
    supports_1050U = False
    supports_V150M = False
    supports_sv_on_var = False
    try:
        lines = file.readlines()
        file.close()
    except IOError:
        system("/usr/bin/logger -p user.warn -t aigen Could not read the build file")
        pass
    for line in lines:
        if line[:19] == "BUILD_PROD_VERSION=":
            ver_string = line[20:-1]
        if line[:20] == "BUILD_1050U_SUPPORT=":
            supports_1050U = True
        if line[:24] == "BUILD_1050RAIDUP_SUPPORT":
            supports_cr = True
        if line[:20] == "BUILD_5050L_SUPPORT=":
            supports_5050L = True
        if line[:20] == "BUILD_V150M_SUPPORT=":
            supports_V150M = True
        if line[:29] == "BUILD_8150_SV_ON_VAR_SUPPORT=":
            supports_sv_on_var = True

    if not supports_cr or not supports_5050L or not supports_sv_on_var or not supports_1050U or not supports_V150M:
        if not manufacturing:
            from appliance_util import get_appliance_model

            spec = get_appliance_model()
            if not supports_cr:
                if spec in ["1050_LR", "1050_MR", "1050_HR"]:
                    raise Exception("Unsafe boot target, aborting.")
            if not supports_1050U:
                if spec in ["1050U"]:
                    raise Exception("Unsafe boot target, aborting.")
            if not supports_5050L:
                if spec in ["5050L"]:
                    raise Exception("Unsafe boot target, aborting.")
            if not supports_V150M:
                if spec in ["V150M"]:
                    raise Exception("Unsafe boot target, aborting.")
            if not supports_sv_on_var:
                if spec in ["8150"]:
                    raise Exception("Cannot boot into partition due to secure vault incompatibility, aborting.")

    # need better checking for empty ver string
    return ver_string
Exemple #2
0
def main():
    # Get the appliance model name from teh MFDB
    model = get_appliance_model()
    print "INFO: Model name is [%s]" % model

    # parse the specs.xml to get the specs list
    parse_spec_file()

    # Get the spec object for this model from specs.xml
    curr_spec = SPECS.get_spec_by_name(model)

    # If the current spec is not present in specs.xml, we 
    # cannot help with this tool
    if not curr_spec:
        print "This tool is not supported on model [%s]" % model
        sys.exit(0)

    # Get the current storage profile this model is running
    # for pre xx55 and xx60 models we will get None
    sprof = get_storage_profile()
    if sprof != None:
        print "INFO: Current profile set to [%s]" % sprof
        # Set the profile view to associate it with the spec
        curr_spec.set_spec_profile_view(sprof)
    else:
        print "INFO: Model does not support profiles"
        

    granlicensestate    = check_license_present(granite_license)
    if granlicensestate:
        print "INFO: Granite license present on the system"
    else:
        print "INFO: Granite license not present on the system"

    rsp55licensestate   = check_license_present(rsp55_license)
    if rsp55licensestate:
        print "INFO: RSP55 license present on the system"
    else:
        print "INFO: RSP55 license not present on the system"

    check_if_hardware_meets_spec(model, curr_spec, granlicensestate, rsp55licensestate)
Exemple #3
0
def get_model():
    model = appliance_util.get_appliance_model()
    if model == None:
        raise rrdm_error ("Unexpected error fetching system model")
    else:
        return model