How to use the gconf.gconf.local_path function in gconf

To help you get started, we’ve selected a few gconf 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 gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
g2.master.server = brickserver
                g3.master.server = brickserver
            else:
                (g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
                g1.master.server.aggregated = gmaster.master.server
                g2.master.server.aggregated = gmaster.master.server
                g3.master.server.aggregated = gmaster.master.server
            # bad bad bad: bad way to do things like this
            # need to make this elegant
            # register the crawlers and start crawling
            # g1 ==> Xsync, g2 ==> config.change_detector(changelog by default)
            # g3 ==> changelog History
            changelog_register_failed = False
            (inf, ouf, ra, wa) = gconf.rpc_fd.split(',')
            changelog_agent = RepceClient(int(inf), int(ouf))
            status = GeorepStatus(gconf.state_file, gconf.local_path)
            status.reset_on_worker_start()
            rv = changelog_agent.version()
            if int(rv) != CHANGELOG_AGENT_CLIENT_VERSION:
                raise GsyncdError(
                    "RePCe major version mismatch(changelog agent): "
                    "local %s, remote %s" %
                    (CHANGELOG_AGENT_CLIENT_VERSION, rv))

            try:
                workdir = g2.setup_working_dir()
                # Register only when change_detector is not set to
                # xsync, else agent will generate changelog files
                # in .processing directory of working dir
                if gconf.change_detector != 'xsync':
                    # register with the changelog library
                    # 9 == log level (DEBUG)
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
raise GsyncdError(
                    "RePCe major version mismatch(changelog agent): "
                    "local %s, remote %s" %
                    (CHANGELOG_AGENT_CLIENT_VERSION, rv))

            try:
                workdir = g2.setup_working_dir()
                # Register only when change_detector is not set to
                # xsync, else agent will generate changelog files
                # in .processing directory of working dir
                if gconf.change_detector != 'xsync':
                    # register with the changelog library
                    # 9 == log level (DEBUG)
                    # 5 == connection retries
                    changelog_agent.init()
                    changelog_agent.register(gconf.local_path,
                                             workdir, gconf.changelog_log_file,
                                             g2.CHANGELOG_LOG_LEVEL,
                                             g2.CHANGELOG_CONN_RETRIES)

                register_time = int(time.time())
                g2.register(register_time, changelog_agent, status)
                g3.register(register_time, changelog_agent, status)
            except ChangelogException as e:
                logging.error("Changelog register failed, %s" % e)
                sys.exit(1)

            g1.register(status=status)
            logging.info("Register time: %s" % register_time)
            # oneshot: Try to use changelog history api, if not
            # available switch to FS crawl
            # Note: if config.change_detector is xsync then
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
def service_loop(self, *args):
        """enter service loop

        - if slave given, instantiate GMaster and
          pass control to that instance, which implements
          master behavior
        - else do that's what's inherited
        """
        if args:
            slave = args[0]
            if gconf.local_path:
                class brickserver(FILE.FILEServer):
                    local_path = gconf.local_path
                    aggregated = self.server

                    @classmethod
                    def entries(cls, path):
                        e = super(brickserver, cls).entries(path)
                        # on the brick don't mess with /.glusterfs
                        if path == '.':
                            try:
                                e.remove('.glusterfs')
                                e.remove('.trashcan')
                            except ValueError:
                                pass
                        return e