Ejemplo n.º 1
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/nodebrowser', config)
     set_attribute(self, 'secured', False, config, as_boolean)
     RequestHandler.configure(self, config)
Ejemplo n.º 2
0
 def _add_child(self, child):
     if isinstance(child,_exporter.Formatter):
         if self.formatter is not None:
             raise EInvalidValue('child',child,('Only one formatter can ' +
                                                'be added to an Exporter'))
         self.formatter = child
     RequestHandler._add_child(self, child)
Ejemplo n.º 3
0
 def _add_child(self, child):
     if isinstance(child,_exporter.Formatter):
         if self.formatter is not None:
             raise EInvalidValue('child',child,('Only one formatter can ' + 
                                                'be added to an Exporter'))
         self.formatter = child
     RequestHandler._add_child(self, child)
Ejemplo n.º 4
0
    def start(self):
        RequestHandler.start(self)
        self.WEB_ROOT = properties.HTTP_ROOT
        if self.parent.server_type == 'HTTPS':
            self.WEB_ROOT = properties.HTTPS_ROOT
        for handler in self.parent.children_nodes():
            if isinstance(handler, FileSpace):
                self.filespace = handler
                break
        err_message = 'PSP handler not running in secured mode because \
                      no %s was found.  Config parameter "secured" \
                      being overriden to False'

        if self.secured and self.filespace:
            try:
                sm = as_node('/services/Security Manager')
            except KeyError:
                msglog.log('broadway', msglog.types.WARN,
                           err_message % 'Security Manager')
                msglog.exception(prefix='Handled')
                self.provides_security = self._secured = False
            else:
                self.security_manager = sm
                self.provides_security = self._secured = True
        else:
            if self.secured:
                # not secured because we could not locate filespace object.
                msglog.log('broadway', msglog.types.WARN,
                           err_message % 'FileSpace manager')
            self.provides_security = self._secured = False
Ejemplo n.º 5
0
 def start(self):
     RequestHandler.start(self)
     self.WEB_ROOT = properties.HTTP_ROOT
     if self.parent.server_type == 'HTTPS':
         self.WEB_ROOT = properties.HTTPS_ROOT
     for handler in self.parent.children_nodes():
         if isinstance(handler, FileSpace):
             self.filespace = handler
             break
     err_message = 'PSP handler not running in secured mode because \
                   no %s was found.  Config parameter "secured" \
                   being overriden to False'
     if self.secured and self.filespace:
         try: sm = as_node('/services/Security Manager')
         except KeyError:
             msglog.log('broadway', msglog.types.WARN,
                        err_message % 'Security Manager')
             msglog.exception(prefix = 'Handled')
             self.provides_security = self._secured = False
         else:
             self.security_manager = sm
             self.provides_security = self._secured = True
     else:
         if self.secured:
             # not secured because we could not locate filespace object.
             msglog.log('broadway', msglog.types.WARN,
                        err_message % 'FileSpace manager')
         self.provides_security = self._secured = False
Ejemplo n.º 6
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/nodebrowser', config)
     self.secured = as_internal_node("/services").secured
     RequestHandler.configure(self, config)
Ejemplo n.º 7
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/backup', config)
     self.secured = as_internal_node("/services").secured
     RequestHandler.configure(self, config)
     return
Ejemplo n.º 8
0
 def __init__(self):
     RequestHandler.__init__(self)
     self.security_manager = None
     self.provides_security = None
     self.filespace = None
     self.cache = {}
     self.html = ''
     self.ROOT_DIR = None
Ejemplo n.º 9
0
 def configure(self, config):
     set_attribute(self, 'request_path', REQUIRED, config)
     set_attribute(self, 'gm_time', 0, config, as_boolean)
     RequestHandler.configure(self, config)
     self.time = _TimeStore(self)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Ejemplo n.º 10
0
 def __init__(self):
     RequestHandler.__init__(self)
     self.security_manager = None
     self.provides_security = None
     self.filespace = None
     self.cache = {}
     self.html = ''
     self.ROOT_DIR = None
Ejemplo n.º 11
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '^/msglog/.*|^/msglog$', config)
     RequestHandler.configure(self, config)
     self.http_published_root = properties.HTTP_ROOT 
     self.handlers = []
     self.install_handlers()  
Ejemplo n.º 12
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '^/msglog/.*|^/msglog$', config)
     RequestHandler.configure(self, config)
     self.http_published_root = properties.HTTP_ROOT
     self.handlers = []
     self.install_handlers()
Ejemplo n.º 13
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/configfile', config)
     set_attribute(self, 'debug', 0, config, as_boolean)
     set_attribute(self, 'safe_save', 1, config, as_boolean)
     set_attribute(self, 'keep_backup', 0, config, as_boolean)
     set_attribute(self, 'authentication', "BASIC", config)
     RequestHandler.configure(self, config)
Ejemplo n.º 14
0
 def configure(self, config):
     RequestHandler.configure(self, config)
     ##
     # @attribute log_n_exceptions:
     #   log_n_exceptions == 0 - don't log RNA exceptions
     #   log_n_exceptions <  0 - log all RNA exceptions
     #   log_n_exceptions >  0 - log LOG_N_EXCEPTIONS RNA exceptions and
     #                           then stop.
     set_attribute(self, 'log_n_exceptions', 0, config)
     return
Ejemplo n.º 15
0
 def configure(self, config):
     RequestHandler.configure(self, config)
     ##
     # @attribute log_n_exceptions:
     #   log_n_exceptions == 0 - don't log RNA exceptions
     #   log_n_exceptions <  0 - log all RNA exceptions
     #   log_n_exceptions >  0 - log LOG_N_EXCEPTIONS RNA exceptions and
     #                           then stop.
     set_attribute(self, 'log_n_exceptions', 0, config)
     return
Ejemplo n.º 16
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/enerwise', config)
     set_attribute(self, 'minimum_backup', 1, config, _days_to_seconds)
     set_attribute(self, 'type', 'exporter', config)
     set_attribute(self, 'log', REQUIRED, config, as_node)
     RequestHandler.configure(self, config)
     self.time = _TimeStore(self)
Ejemplo n.º 17
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/enerwise', config)
     set_attribute(self, 'minimum_backup', 1, config, _days_to_seconds)
     set_attribute(self, 'type', 'exporter', config)
     set_attribute(self, 'log', REQUIRED, config, as_node)
     RequestHandler.configure(self, config)
     self.time = _TimeStore(self)
Ejemplo n.º 18
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, "request_path", "/configfile", config)
     set_attribute(self, "debug", 0, config, as_boolean)
     set_attribute(self, "safe_save", 1, config, as_boolean)
     set_attribute(self, "keep_backup", 0, config, as_boolean)
     set_attribute(self, "authentication", "BASIC", config)
     RequestHandler.configure(self, config)
Ejemplo n.º 19
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', REQUIRED, config)
     set_attribute(self, 'log', REQUIRED, config, as_node)
     set_attribute(self, 'gm_time', 0, config, as_boolean)
     RequestHandler.configure(self, config)
     self.time = _TimeStore(self)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Ejemplo n.º 20
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', REQUIRED, config)
     set_attribute(self, 'log', REQUIRED, config, as_node)
     set_attribute(self, 'gm_time', 0, config, as_boolean)
     RequestHandler.configure(self, config)
     self.time = _TimeStore(self)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Ejemplo n.º 21
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'secured', config, str)
     get_attribute(self, 'provides_security', config)
     get_attribute(self, 'authentication', config)
     return config
Ejemplo n.º 22
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'minimum_backup', config, _seconds_to_days)
     get_attribute(self, 'type', config)
     get_attribute(self, 'log', config, as_node_url)
     return config
Ejemplo n.º 23
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'secured', config, str)
     get_attribute(self, 'provides_security', config)
     get_attribute(self, 'authentication', config)
     return config
Ejemplo n.º 24
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'minimum_backup', config, _seconds_to_days)
     get_attribute(self, 'type', config)
     get_attribute(self, 'log', config, as_node_url)
     return config
Ejemplo n.º 25
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'debug', config)
     get_attribute(self, 'safe_save', config)
     get_attribute(self, 'keep_backup', config)
     get_attribute(self, 'authentication', config)
     return config
Ejemplo n.º 26
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, "request_path", config)
     get_attribute(self, "debug", config)
     get_attribute(self, "safe_save", config)
     get_attribute(self, "keep_backup", config)
     get_attribute(self, "authentication", config)
     return config
Ejemplo n.º 27
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/xmlrpc', config)
     set_attribute(self, 'deployed_objects', [], config)
     set_attribute(self, 'debug', 0, config)
     # requires_authentication is deprecated; provides_security more obvious.
     provides_security = config.get('requires_authentication', 1)
     set_attribute(self, 'provides_security', provides_security, config,
                   as_boolean)
     self.secured = as_internal_node("/services").secured
     RequestHandler.configure(self, config)
     if self.secured:
         rna_xmlrpc = 'mpx.lib.xmlrpc.rna_xmlrpc.SecuredXmlRpcHandler'
         rna_xmlrpc2 = 'mpx.lib.xmlrpc.rna_xmlrpc.SecuredXmlRpcHandler2'
     else:
         rna_xmlrpc = 'mpx.lib.xmlrpc.rna_xmlrpc.RNA_XMLRPC_Handler'
         rna_xmlrpc2 = 'mpx.lib.xmlrpc.rna_xmlrpc.RNA_XMLRPC_Handler2'
     ## Pre-Register important XMLRPC Objects such RNA
     ## rna_xmlrpc -- Default RNA over XMLRPC handler
     child = XMLRPC_Deploy()
     params = {
         'name': 'rna_xmlrpc',
         'alias': 'rna_xmlrpc',
         'class_name': rna_xmlrpc,
         'lifetime': 'Runtime',
         'parent': self
     }
     child.configure(params)
     ## rna_xmlrpc2 -- Next Generation RNA over XMLRPC handler
     child = XMLRPC_Deploy()
     params = {
         'name': 'rna_xmlrpc2',
         'alias': 'rna_xmlrpc2',
         'class_name': rna_xmlrpc2,
         'lifetime': 'Runtime',
         'parent': self
     }
     child.configure(params)
Ejemplo n.º 28
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/XMLRPCv2', config)
     set_attribute(self, 'debug', 0, config)
     # requires_authentication is deprecated; provides_security more obvious.
     provides_security = config.get('requires_authentication', 1)
     set_attribute(
         self, 'provides_security', provides_security, config, as_boolean)
     self.secured = as_internal_node("/services").secured
     set_attribute(self, 'authentication', 'basic', config)
     if self.authentication not in ('digest','basic','form'):
         raise EInvalidValue('authentication',self.authentication,
                             'Authentication scheme not recognized.')
     RequestHandler.configure(self, config)
     # create the inherient child RNA
     if not self.has_child('RNA'):
         rna = RNA()
         config = {'parent':self,'name':'RNA', 'log_n_exceptions':0}
         rna.configure(config)
     return
Ejemplo n.º 29
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/XMLRPCv2', config)
     set_attribute(self, 'debug', 0, config)
     # requires_authentication is deprecated; provides_security more obvious.
     provides_security = config.get('requires_authentication', 1)
     set_attribute(self, 'provides_security', provides_security, config,
                   as_boolean)
     self.secured = as_internal_node("/services").secured
     set_attribute(self, 'authentication', 'basic', config)
     if self.authentication not in ('digest', 'basic', 'form'):
         raise EInvalidValue('authentication', self.authentication,
                             'Authentication scheme not recognized.')
     RequestHandler.configure(self, config)
     # create the inherient child RNA
     if not self.has_child('RNA'):
         rna = RNA()
         config = {'parent': self, 'name': 'RNA', 'log_n_exceptions': 0}
         rna.configure(config)
     return
Ejemplo n.º 30
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '/xmlrpc', config)
     set_attribute(self, 'deployed_objects',[],config)
     set_attribute(self, 'debug', 0, config)
     # requires_authentication is deprecated; provides_security more obvious.
     provides_security = config.get('requires_authentication', 1)
     set_attribute(
         self, 'provides_security', provides_security, config, as_boolean)
     self.secured = as_internal_node("/services").secured
     RequestHandler.configure(self, config)
     if self.secured:
         rna_xmlrpc = 'mpx.lib.xmlrpc.rna_xmlrpc.SecuredXmlRpcHandler'
         rna_xmlrpc2 = 'mpx.lib.xmlrpc.rna_xmlrpc.SecuredXmlRpcHandler2'
     else:
         rna_xmlrpc = 'mpx.lib.xmlrpc.rna_xmlrpc.RNA_XMLRPC_Handler'
         rna_xmlrpc2 = 'mpx.lib.xmlrpc.rna_xmlrpc.RNA_XMLRPC_Handler2'
     ## Pre-Register important XMLRPC Objects such RNA
     ## rna_xmlrpc -- Default RNA over XMLRPC handler
     child = XMLRPC_Deploy()
     params = {'name':'rna_xmlrpc',
               'alias':'rna_xmlrpc',
               'class_name': rna_xmlrpc,
               'lifetime':'Runtime',
               'parent':self}
     child.configure(params)
     ## rna_xmlrpc2 -- Next Generation RNA over XMLRPC handler
     child = XMLRPC_Deploy()
     params = {'name':'rna_xmlrpc2',
               'alias':'rna_xmlrpc2',
               'class_name': rna_xmlrpc2,
               'lifetime':'Runtime',
               'parent':self}
     child.configure(params)
Ejemplo n.º 31
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'secured', config, str)
     return config
Ejemplo n.º 32
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'log_n_exceptions', config)
     return config
Ejemplo n.º 33
0
 def configure(self, config):
     RequestHandler.configure(self, config)
     set_attribute(self, 'request_path', 'alarms', config)
Ejemplo n.º 34
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
Ejemplo n.º 35
0
 def __init__(self):
     self.formatter = None
     RequestHandler.__init__(self)
Ejemplo n.º 36
0
 def start(self):
     RequestHandler.start(self)
Ejemplo n.º 37
0
 def configure(self, config):
     RequestHandler.configure(self, config)
     set_attribute(self,'request_path','alarms',config)
Ejemplo n.º 38
0
 def configure(self,config):
     RequestHandler.configure(self,config)
     set_attribute(self,'request_path','.*\.psp$',config)
     set_attribute(self, 'provides_security', 1, config, as_boolean)
     self.secured = as_boolean(as_internal_node("/services").secured)
     self.request_regex = re.compile(self.request_path)
Ejemplo n.º 39
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'log', config, as_node_url)
     return config
Ejemplo n.º 40
0
 def __init__(self):
     RequestHandler.__init__(self)
     self.b_service = as_deferred_node('/services/backup_registry')
Ejemplo n.º 41
0
 def _add_child(self, child):
     if child.type == _exporter.ChildrenTypes.FORMATTER:
         self.formatter = child
     RequestHandler._add_child(self, child)
Ejemplo n.º 42
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '^/properties$', config)
     RequestHandler.configure(self, config)
Ejemplo n.º 43
0
 def configure(self, config):
     # The request_path tells the http_server which url requests
     #   should be sent to this handler.  It can be a regular expression
     #   as defined in the documentation for the python re module.
     set_attribute(self, 'request_path', '^/properties$', config) 
     RequestHandler.configure(self, config)
Ejemplo n.º 44
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'log_n_exceptions', config)
     return config
Ejemplo n.º 45
0
 def __init__(self):
     self.formatter = None
     RequestHandler.__init__(self)
Ejemplo n.º 46
0
 def __init__(self):
     RequestHandler.__init__(self)
Ejemplo n.º 47
0
 def start(self):
     RequestHandler.start(self)
Ejemplo n.º 48
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
Ejemplo n.º 49
0
 def _add_child(self, child):
     if child.type == _exporter.ChildrenTypes.FORMATTER:
         self.formatter = child
     RequestHandler._add_child(self, child)
Ejemplo n.º 50
0
 def configure(self, config):
     RequestHandler.configure(self, config)
     set_attribute(self, 'request_path', '.*\.psp$', config)
     set_attribute(self, 'provides_security', 1, config, as_boolean)
     self.secured = as_boolean(as_internal_node("/services").secured)
     self.request_regex = re.compile(self.request_path)
Ejemplo n.º 51
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'log', config, as_node_url)
     return config
Ejemplo n.º 52
0
 def configuration(self):
     config = RequestHandler.configuration(self)
     get_attribute(self, 'request_path', config)
     get_attribute(self, 'secured', config, str)
     return config
Ejemplo n.º 53
0
 def __init__(self):
     RequestHandler.__init__(self)
     self.b_service = as_deferred_node('/services/backup_registry')