How to use the solnlib.modular_input.checkpointer function in solnlib

To help you get started, we’ve selected a few solnlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PaloAltoNetworks / Splunk_TA_paloalto / bin / splunk_ta_paloalto / modinput_wrapper / base_modinput.py View on Github external
def _init_ckpt(self):
        if self.ckpt is None:
            if 'AOB_TEST' in os.environ:
                ckpt_dir = self.context_meta.get('checkpoint_dir', tempfile.mkdtemp())
                if not os.path.exists(ckpt_dir):
                    os.makedirs(ckpt_dir)
                self.ckpt = checkpointer.FileCheckpointer(ckpt_dir)
            else:
                if 'server_uri' not in self.context_meta:
                    raise ValueError('server_uri not found in input meta.')
                if 'session_key' not in self.context_meta:
                    raise ValueError('session_key not found in input meta.')
                dscheme, dhost, dport = sutils.extract_http_scheme_host_port(self.context_meta[
                                                                                 'server_uri'])
                self.ckpt = checkpointer.KVStoreCheckpointer(self.app + "_checkpointer",
                                                             self.context_meta['session_key'], self.app,
                                                             scheme=dscheme, host=dhost, port=dport)
github PaloAltoNetworks / pandevice / install / Splunk_TA_paloalto / bin / splunk_ta_paloalto / solnlib / modular_input / modular_input.py View on Github external
[self.app, self.config_name,
                 self.kvstore_checkpointer_collection_name])
            checkpointer_name = ':'.join(
                [self.app, self.config_name,
                 self.kvstore_checkpointer_collection_name])
            try:
                return checkpointer.KVStoreCheckpointer(
                    checkpointer_name, self.session_key,
                    self.app, owner='nobody', scheme=self.server_scheme,
                    host=self.server_host, port=self.server_port)
            except binding.HTTPError as e:
                logging.error('Failed to init kvstore checkpointer: %s.',
                              traceback.format_exc(e))
                raise
        else:
            return checkpointer.FileCheckpointer(self._checkpoint_dir)
github PaloAltoNetworks / pandevice / install / Splunk_TA_paloalto / bin / splunk_ta_paloalto / modinput_wrapper / base_modinput.py View on Github external
def _init_ckpt(self):
        if self.ckpt is None:
            if 'AOB_TEST' in os.environ:
                ckpt_dir = self.context_meta.get('checkpoint_dir', tempfile.mkdtemp())
                if not os.path.exists(ckpt_dir):
                    os.makedirs(ckpt_dir)
                self.ckpt = checkpointer.FileCheckpointer(ckpt_dir)
            else:
                if 'server_uri' not in self.context_meta:
                    raise ValueError('server_uri not found in input meta.')
                if 'session_key' not in self.context_meta:
                    raise ValueError('session_key not found in input meta.')
                dscheme, dhost, dport = sutils.extract_http_scheme_host_port(self.context_meta[
                                                                             'server_uri'])
                self.ckpt = checkpointer.KVStoreCheckpointer(self.app + "_checkpointer", self.context_meta['session_key'], self.app,
                                                             scheme=dscheme, host=dhost, port=dport)
github PaloAltoNetworks / Splunk_TA_paloalto / bin / splunk_ta_paloalto / modinput_wrapper / base_modinput.py View on Github external
def _init_ckpt(self):
        if self.ckpt is None:
            if 'AOB_TEST' in os.environ:
                ckpt_dir = self.context_meta.get('checkpoint_dir', tempfile.mkdtemp())
                if not os.path.exists(ckpt_dir):
                    os.makedirs(ckpt_dir)
                self.ckpt = checkpointer.FileCheckpointer(ckpt_dir)
            else:
                if 'server_uri' not in self.context_meta:
                    raise ValueError('server_uri not found in input meta.')
                if 'session_key' not in self.context_meta:
                    raise ValueError('session_key not found in input meta.')
                dscheme, dhost, dport = sutils.extract_http_scheme_host_port(self.context_meta[
                                                                                 'server_uri'])
                self.ckpt = checkpointer.KVStoreCheckpointer(self.app + "_checkpointer",
                                                             self.context_meta['session_key'], self.app,
                                                             scheme=dscheme, host=dhost, port=dport)
github PaloAltoNetworks / pandevice / install / Splunk_TA_paloalto / bin / splunk_ta_paloalto / modinput_wrapper / base_modinput.py View on Github external
def _init_ckpt(self):
        if self.ckpt is None:
            if 'AOB_TEST' in os.environ:
                ckpt_dir = self.context_meta.get('checkpoint_dir', tempfile.mkdtemp())
                if not os.path.exists(ckpt_dir):
                    os.makedirs(ckpt_dir)
                self.ckpt = checkpointer.FileCheckpointer(ckpt_dir)
            else:
                if 'server_uri' not in self.context_meta:
                    raise ValueError('server_uri not found in input meta.')
                if 'session_key' not in self.context_meta:
                    raise ValueError('session_key not found in input meta.')
                dscheme, dhost, dport = sutils.extract_http_scheme_host_port(self.context_meta[
                                                                             'server_uri'])
                self.ckpt = checkpointer.KVStoreCheckpointer(self.app + "_checkpointer", self.context_meta['session_key'], self.app,
                                                             scheme=dscheme, host=dhost, port=dport)
github PaloAltoNetworks / pandevice / install / Splunk_TA_paloalto / bin / splunk_ta_paloalto / solnlib / modular_input / modular_input.py View on Github external
def _create_checkpointer(self):
        if self.use_kvstore_checkpointer:
            checkpointer_name = ':'.join(
                [self.app, self.config_name,
                 self.kvstore_checkpointer_collection_name])
            checkpointer_name = ':'.join(
                [self.app, self.config_name,
                 self.kvstore_checkpointer_collection_name])
            try:
                return checkpointer.KVStoreCheckpointer(
                    checkpointer_name, self.session_key,
                    self.app, owner='nobody', scheme=self.server_scheme,
                    host=self.server_host, port=self.server_port)
            except binding.HTTPError as e:
                logging.error('Failed to init kvstore checkpointer: %s.',
                              traceback.format_exc(e))
                raise
        else:
            return checkpointer.FileCheckpointer(self._checkpoint_dir)