예제 #1
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only:
    
            # Get the timestamp in the two formats we wanted
            epoch = str(time.time())
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
    
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {'locationId':   'TIMESTAMP',
                        'subClusterId': subClusterId,
                        'clusterId':    cluster_id,
                        'locationName': 'TIMESTAMP',
                        'version':      epoch,
                        'path':         now,
                        }
    
                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)

    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise
예제 #2
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only:
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            osg_grid = cp_get(cp, "osg_dirs", "grid_dir", None)
    
            if not osg_grid:
                raise RuntimeError('grid_dir ($OSG_GRID) not defined!')
                
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {'locationId':   'OSG_GRID',
                        'subClusterId': subClusterId,
                        'clusterId':    cluster_id,
                        'locationName': 'OSG_GRID',
                        'version':      1.0,
                        'path':         osg_grid,
                       }
        
                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)
            
    except Exception, e:
        # Log error, then report it via stderr.
        log.error(e)
        sys.stdout = sys.stderr
        raise
예제 #3
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only:

            # Get the timestamp in the two formats we wanted
            epoch = str(time.time())
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())

            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {
                    'locationId': 'TIMESTAMP',
                    'subClusterId': subClusterId,
                    'clusterId': cluster_id,
                    'locationName': 'TIMESTAMP',
                    'version': epoch,
                    'path': now,
                }

                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)

    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise
예제 #4
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only:
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            osg_grid = cp_get(cp, "osg_dirs", "grid_dir", None)

            if not osg_grid:
                raise RuntimeError('grid_dir ($OSG_GRID) not defined!')

            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {
                    'locationId': 'OSG_GRID',
                    'subClusterId': subClusterId,
                    'clusterId': cluster_id,
                    'locationName': 'OSG_GRID',
                    'version': 1.0,
                    'path': osg_grid,
                }

                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)

    except Exception, e:
        # Log error, then report it via stderr.
        log.error(e)
        sys.stdout = sys.stderr
        raise
예제 #5
0
파일: software.py 프로젝트: tiradani/gip
def print_Locations(cp):
    template = getTemplate("GlueCluster", "GlueLocationLocalID")
    cluster_id = getClusterID(cp)
    for subClusterId in getSubClusterIDs(cp):
        for entry in getApplications(cp):
            entry['subClusterId'] = subClusterId
            entry['clusterId'] = cluster_id
            printTemplate(template, entry)
예제 #6
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only and 'VDT_LOCATION' in os.environ:

            # get the VDT version
            vdt_version_cmd = os.path.expandvars(
                "$VDT_LOCATION/vdt/bin/") + 'vdt-version --no-wget'
            vdt_version_out = runCommand(vdt_version_cmd).readlines()

            gip_re = re.compile('Generic Information Provider\s+(.*?)\s*-.*')
            gip_version = 'UNKNOWN'
            for line in vdt_version_out:
                m = gip_re.match(line)
                if m:
                    gip_version = m.groups()[0]
                    break

            gip_version += '; $Revision$'

            # Get the timestamp in the two formats we wanted
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())

            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {
                    'locationId': 'GIP_VERSION',
                    'subClusterId': subClusterId,
                    'clusterId': cluster_id,
                    'locationName': 'GIP_VERSION',
                    'version': gip_version,
                    'path': now,
                }

                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)

    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise
예제 #7
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only and 'VDT_LOCATION' in os.environ:
    
            # get the VDT version
            vdt_version_cmd = os.path.expandvars("$VDT_LOCATION/vdt/bin/") + 'vdt-version --no-wget'
            vdt_version_out = runCommand(vdt_version_cmd).readlines()
    
            gip_re = re.compile('Generic Information Provider\s+(.*?)\s*-.*')
            gip_version = 'UNKNOWN'
            for line in vdt_version_out:
                m = gip_re.match(line)
                if m:
                    gip_version = m.groups()[0]
                    break
    
            gip_version += '; $Revision$'
    
            # Get the timestamp in the two formats we wanted
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
    
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {'locationId':   'GIP_VERSION',
                        'subClusterId': subClusterId,
                        'clusterId':    cluster_id,
                        'locationName': 'GIP_VERSION',
                        'version':      gip_version,
                        'path':         now,
                       }
        
                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)
            
    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise
예제 #8
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only and 'VDT_LOCATION' in os.environ: 
    
            # get the VDT version
            vdt_version_cmd = os.path.expandvars("$VDT_LOCATION/vdt/bin/") + 'vdt-version --brief'
            vdt_version = runCommand(vdt_version_cmd).readlines()[0].strip()
            if (vdt_version == ""): vdt_version = "OLD_VDT"
            
            # Get the timestamp in the two formats we wanted
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
    
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {'locationId':   'VDT_VERSION',
                        'subClusterId': subClusterId,
                        'clusterId':    cluster_id,
                        'locationName': 'VDT_VERSION',
                        'version':      vdt_version,
                        'path':         now,
                       }
        
                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)
            
    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise
예제 #9
0
def main():
    try:
        # Load up the site configuration
        cp = config()
        se_only = cp_getBoolean(cp, "gip", "se_only", False)
        if not se_only and 'VDT_LOCATION' in os.environ: 
    
            # get the VDT version
            vdt_version_cmd = os.path.expandvars("$VDT_LOCATION/vdt/bin/") + 'vdt-version --brief'
            vdt_version = runCommand(vdt_version_cmd).readlines()[0].strip()
            if (vdt_version == ""): vdt_version = "OLD_VDT"
            
            # Get the timestamp in the two formats we wanted
            now = time.strftime("%a %b %d %T UTC %Y", time.gmtime())
    
            # Load up the template for GlueLocationLocalID
            # To view its contents, see $VDT_LOCATION/gip/templates/GlueCluster
            template = getTemplate("GlueCluster", "GlueLocationLocalID")
            cluster_id = getClusterID(cp)
            for subClusterId in getSubClusterIDs(cp):
                # Dictionary of data to fill in for GlueLocationLocalID
                info = {'locationId':   'VDT_VERSION',
                        'subClusterId': subClusterId,
                        'clusterId':    cluster_id,
                        'locationName': 'VDT_VERSION',
                        'version':      vdt_version,
                        'path':         now,
                       }
        
                # Spit out our template, fill it with the appropriate info.
                printTemplate(template, info)
            
    except Exception, e:
        # Log error, then report it via stderr.
        log.exception(e)
        sys.stdout = sys.stderr
        raise