コード例 #1
0
    def parse_configuration(self, configuration):
        """
        Try to get configuration information from ConfigParser or SafeConfigParser
        object given by configuration and write recognized settings to attributes
        dict
        """
        self.log("StorageConfiguration.parse_configuration started")

        self.check_config(configuration)

        if not configuration.has_section(self.config_section):
            self.enabled = False
            self.log("%s section not in config file" % self.config_section)
            self.log("StorageConfiguration.parse_configuration completed")
            return
        # This module is called Storage, but it's actually needed for a CE:
        # The main script's write_attributes() will fail if certain options,
        # e.g. 'OSG_GRID' aren't defined, and this module defines them.
        if not utilities.gateway_installed():
            self.enabled = False
            self.log("No job gateway installed, skipping CE specific module")
            self.log("StorageConfiguration.parse_configuration completed")
            return
        else:
            self.enabled = True

        self.get_options(configuration)
        self.log("StorageConfiguration.parse_configuration completed")
コード例 #2
0
    def parse_configuration(self, configuration):
        """
        Try to get configuration information from ConfigParser or SafeConfigParser
        object given by configuration and write recognized settings to attributes
        dict
        """
        self.log('StorageConfiguration.parse_configuration started')

        self.check_config(configuration)

        if not configuration.has_section(self.config_section):
            self.enabled = False
            self.log("%s section not in config file" % self.config_section)
            self.log('StorageConfiguration.parse_configuration completed')
            return
        # This module is called Storage, but it's actually needed for a CE:
        # The main script's write_attributes() will fail if certain options,
        # e.g. 'OSG_GRID' aren't defined, and this module defines them.
        if not utilities.gateway_installed():
            self.enabled = False
            self.log("No job gateway installed, skipping CE specific module")
            self.log('StorageConfiguration.parse_configuration completed')
            return
        else:
            self.enabled = True

        self.get_options(configuration)
        self.log('StorageConfiguration.parse_configuration completed')
コード例 #3
0
    def __init__(self, *args, **kwargs):
        # pylint: disable-msg=W0142
        super(InfoServicesConfiguration, self).__init__(*args, **kwargs)
        self.log("InfoServicesConfiguration.__init__ started")
        # file location for xml file with info services subscriptions
        self.config_section = 'Info Services'
        self.options = {
            'bdii_servers':
            configfile.Option(name='bdii_servers', default_value=''),
            'ce_collectors':
            configfile.Option(name='ce_collectors',
                              default_value='',
                              required=configfile.Option.OPTIONAL)
        }
        self._itb_defaults = {
            'bdii_servers':
            'http://is1.grid.iu.edu:14001[RAW],http://is2.grid.iu.edu:14001[RAW]',
            'ce_collectors':
            'collector-itb.opensciencegrid.org:%d' % HTCONDOR_CE_COLLECTOR_PORT
        }
        self._production_defaults = {
            'bdii_servers':
            'http://is1.grid.iu.edu:14001[RAW],http://is2.grid.iu.edu:14001[RAW]',
            'ce_collectors':
            'collector1.opensciencegrid.org:%d,collector2.opensciencegrid.org:%d'
            % (HTCONDOR_CE_COLLECTOR_PORT, HTCONDOR_CE_COLLECTOR_PORT)
        }
        self.bdii_servers = {}
        self.copy_host_cert_for_service_cert = False

        self.ois_required_rpms_installed = utilities.gateway_installed(
        ) and utilities.rpm_installed('osg-info-services')

        # for htcondor-ce-info-services:
        self.ce_collectors = []
        self.ce_collector_required_rpms_installed = utilities.rpm_installed(
            'htcondor-ce')
        self.osg_resource = ""
        self.osg_resource_group = ""
        self.enabled_batch_systems = []
        self.htcondor_gateway_enabled = None
        self.resource_catalog = None
        self.authorization_method = None
        self.subcluster_sections = None

        self.log("InfoServicesConfiguration.__init__ completed")
コード例 #4
0
    def __init__(self, *args, **kwargs):
        # pylint: disable-msg=W0142
        super(InfoServicesConfiguration, self).__init__(*args, **kwargs)
        self.log("InfoServicesConfiguration.__init__ started")
        # file location for xml file with info services subscriptions
        self.config_section = 'Info Services'
        self.options = {'bdii_servers': configfile.Option(name='bdii_servers',
                                                          default_value=''),
                        'ce_collectors': configfile.Option(name='ce_collectors',
                                                           default_value='',
                                                           required=configfile.Option.OPTIONAL)}
        self._itb_defaults = {
            'bdii_servers': 'http://is1.grid.iu.edu:14001[RAW],http://is2.grid.iu.edu:14001[RAW]',
            'ce_collectors': 'collector-itb.opensciencegrid.org:%d' % HTCONDOR_CE_COLLECTOR_PORT}
        self._production_defaults = {
            'bdii_servers': 'http://is1.grid.iu.edu:14001[RAW],http://is2.grid.iu.edu:14001[RAW]',
            'ce_collectors': 'collector1.opensciencegrid.org:%d,collector2.opensciencegrid.org:%d' % (
                HTCONDOR_CE_COLLECTOR_PORT, HTCONDOR_CE_COLLECTOR_PORT)}
        self.bdii_servers = {}
        self.copy_host_cert_for_service_cert = False

        self.ois_required_rpms_installed = utilities.gateway_installed() and utilities.rpm_installed(
            'osg-info-services')

        # for htcondor-ce-info-services:
        self.ce_collectors = []
        self.ce_collector_required_rpms_installed = utilities.rpm_installed('htcondor-ce')
        self.osg_resource = ""
        self.osg_resource_group = ""
        self.enabled_batch_systems = []
        self.htcondor_gateway_enabled = None
        self.resource_catalog = None
        self.authorization_method = None
        self.subcluster_sections = None

        self.log("InfoServicesConfiguration.__init__ completed")
コード例 #5
0
ファイル: gratia.py プロジェクト: djw8605/osg-configure
def requirements_are_installed():
    return (utilities.gateway_installed() and
            utilities.any_rpms_installed(CE_PROBE_RPMS))
コード例 #6
0
ファイル: gratia.py プロジェクト: bbockelm/osg-configure
def requirements_are_installed():
    return (utilities.gateway_installed()
            and utilities.any_rpms_installed(CE_PROBE_RPMS))
コード例 #7
0
    def check_attributes(self, attributes):
        """Check attributes currently stored and make sure that they are consistent"""
        self.log('SquidConfiguration.check_attributes started')
        attributes_ok = True
        if not (utilities.gateway_installed()
                and utilities.rpm_installed('frontier-squid')):
            return attributes_ok

        if not self.enabled:
            self.log(
                "Squid is not enabled, sites must enable this \n" +
                "section, location can be set to UNAVAILABLE if squid is \n" +
                "not present",
                level=logging.WARNING)
            self.log('squid not enabled')
            self.log('SquidConfiguration.check_attributes completed')
            return attributes_ok

        if self.ignored:
            self.log('Ignored, returning True')
            self.log('SquidConfiguration.check_attributes completed')
            return attributes_ok

        if (self.options['location'].value == 'None'):
            self.log(
                "location setting must be set, if site does not provide " +
                "squid, please use UNAVAILABLE",
                section=self.config_section,
                option='location',
                level=logging.WARNING)
            return attributes_ok

        if (self.options['location'].value.upper() == 'UNAVAILABLE'):
            self.log(
                "Squid location is set to UNAVAILABLE.  Although this is \n" +
                "allowed, most jobs function better and use less bandwidth \n"
                + "when a squid proxy is available",
                level=logging.WARN)
            self.options['location'].value = 'None'
            return attributes_ok

        if len(self.options['location'].value.split(':')) != 2:
            self.log("Bad host specification, got %s expected hostname:port " \
                     "(e.g. localhost:3128)" % self.options['location'].value,
                     section=self.config_section,
                     option='location',
                     level=logging.ERROR)
            attributes_ok = False
            return attributes_ok
        (hostname, port) = self.options['location'].value.split(':')
        if not validation.valid_domain(hostname, True):
            self.log("Invalid hostname for squid location: %s" % \
                     self.options['location'].value,
                     section=self.config_section,
                     option='location',
                     level=logging.ERROR)
            attributes_ok = False
        try:
            int(port)
        except ValueError:
            self.log("The port must be a number(e.g. host:3128) for squid " \
                     "location: %s" % self.options['location'].value,
                     section=self.config_section,
                     option='location',
                     level=logging.ERROR,
                     exception=True)
            attributes_ok = False

        self.log('SquidConfiguration.check_attributes completed')
        return attributes_ok
コード例 #8
0
    def check_attributes(self, attributes):
        """Check attributes currently stored and make sure that they are consistent"""
        self.log("SquidConfiguration.check_attributes started")
        attributes_ok = True
        if not (utilities.gateway_installed() and utilities.rpm_installed("frontier-squid")):
            return attributes_ok

        if not self.enabled:
            self.log(
                "Squid is not enabled, sites must enable this \n"
                + "section, location can be set to UNAVAILABLE if squid is \n"
                + "not present",
                level=logging.WARNING,
            )
            self.log("squid not enabled")
            self.log("SquidConfiguration.check_attributes completed")
            return attributes_ok

        if self.ignored:
            self.log("Ignored, returning True")
            self.log("SquidConfiguration.check_attributes completed")
            return attributes_ok

        if self.options["location"].value == "None":
            self.log(
                "location setting must be set, if site does not provide " + "squid, please use UNAVAILABLE",
                section=self.config_section,
                option="location",
                level=logging.WARNING,
            )
            return attributes_ok

        if self.options["location"].value.upper() == "UNAVAILABLE":
            self.log(
                "Squid location is set to UNAVAILABLE.  Although this is \n"
                + "allowed, most jobs function better and use less bandwidth \n"
                + "when a squid proxy is available",
                level=logging.WARN,
            )
            self.options["location"].value = "None"
            return attributes_ok

        if len(self.options["location"].value.split(":")) != 2:
            self.log(
                "Bad host specification, got %s expected hostname:port "
                "(e.g. localhost:3128)" % self.options["location"].value,
                section=self.config_section,
                option="location",
                level=logging.ERROR,
            )
            attributes_ok = False
            return attributes_ok
        (hostname, port) = self.options["location"].value.split(":")
        if not validation.valid_domain(hostname, True):
            self.log(
                "Invalid hostname for squid location: %s" % self.options["location"].value,
                section=self.config_section,
                option="location",
                level=logging.ERROR,
            )
            attributes_ok = False
        try:
            int(port)
        except ValueError:
            self.log(
                "The port must be a number(e.g. host:3128) for squid " "location: %s" % self.options["location"].value,
                section=self.config_section,
                option="location",
                level=logging.ERROR,
                exception=True,
            )
            attributes_ok = False

        self.log("SquidConfiguration.check_attributes completed")
        return attributes_ok