How to use the gconf.gconf 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
def rsync(self, files, *args, **kw):
        """invoke rsync"""
        if not files:
            raise GsyncdError("no files to sync")
        logging.debug("files: " + ", ".join(files))
        argv = gconf.rsync_command.split() + \
            ['-aR0', '--inplace', '--files-from=-', '--super',
             '--stats', '--numeric-ids', '--no-implied-dirs'] + \
            gconf.rsync_options.split() + \
            (boolify(gconf.sync_xattrs) and ['--xattrs'] or []) + \
            (boolify(gconf.sync_acls) and ['--acls'] or []) + \
            ['.'] + list(args)

        if gconf.log_rsync_performance:
            # use stdout=PIPE only when log_rsync_performance enabled
            # Else rsync will write to stdout and nobody is their
            # to consume. If PIPE is full rsync hangs.
            po = Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE)
        else:
            po = Popen(argv, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
def rsync(self, files, log_err=False):
        return sup(self, files, '-e',
                   " ".join(gconf.ssh_command.split() +
                            ["-p", str(gconf.ssh_port)] +
                            gconf.ssh_ctl_args),
                   *(gconf.rsync_ssh_options.split() + [self.slaveurl]),
                   log_err=log_err)
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
def connect(self):
        """inhibit the resource beyond

        Choose mounting backend (direct or mountbroker),
        set up glusterfs parameters and perform the mount
        with given backend
        """

        label = getattr(gconf, 'mountbroker', None)
        if not label and not privileged():
            label = syncdutils.getusername()
        mounter = label and self.MountbrokerMounter or self.DirectMounter
        params = gconf.gluster_params.split() + \
            (gconf.gluster_log_level and ['log-level=' +
                                          gconf.gluster_log_level] or []) + \
            ['log-file=' + gconf.gluster_log_file, 'volfile-server=' +
             self.host, 'volfile-id=' + self.volume, 'client-pid=-1']
        mounter(params).inhibit(*[l for l in [label] if l])
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
(g1, g2, g3) = self.gmaster_instantiate_tuple(slave)
                g1.master.server = brickserver
                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':
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
def rsync(self, files, *args, **kw):
        """invoke rsync"""
        if not files:
            raise GsyncdError("no files to sync")
        logging.debug("files: " + ", ".join(files))
        argv = gconf.rsync_command.split() + \
            ['-aR0', '--inplace', '--files-from=-', '--super',
             '--stats', '--numeric-ids', '--no-implied-dirs'] + \
            gconf.rsync_options.split() + \
            (boolify(gconf.sync_xattrs) and ['--xattrs'] or []) + \
            (boolify(gconf.sync_acls) and ['--acls'] or []) + \
            ['.'] + list(args)

        if gconf.log_rsync_performance:
            # use stdout=PIPE only when log_rsync_performance enabled
            # Else rsync will write to stdout and nobody is their
            # to consume. If PIPE is full rsync hangs.
            po = Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE)
        else:
            po = Popen(argv, stdin=subprocess.PIPE, stderr=subprocess.PIPE)

        for f in files:
            po.stdin.write(f)
            po.stdin.write('\0')
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
if self.mntpt:
                    # mntpt is determined pre-mount
                    d = self.mntpt
                    os.write(mpo, d + '\0')
                po = Popen(margv, **self.mountkw)
                self.handle_mounter(po)
                po.terminate_geterr()
                logging.debug('auxiliary glusterfs mount in place')
                if not d:
                    # mntpt is determined during mount
                    d = self.mntpt
                    os.write(mpo, d + '\0')
                os.write(mpo, 'M')
                t = syncdutils.Thread(target=lambda: os.chdir(d))
                t.start()
                tlim = gconf.starttime + int(gconf.connection_timeout)
                while True:
                    if not t.isAlive():
                        break
                    if time.time() >= tlim:
                        syncdutils.finalize(exval=1)
                    time.sleep(1)
                os.close(mpo)
                _, rv = syncdutils.waitpid(mh, 0)
                if rv:
                    rv = (os.WIFEXITED(rv) and os.WEXITSTATUS(rv) or 0) - \
                         (os.WIFSIGNALED(rv) and os.WTERMSIG(rv) or 0)
                    logging.warn('stale mount possibly left behind on ' + d)
                    raise GsyncdError("cleaning up temp mountpoint %s "
                                      "failed with status %d" %
                                      (d, rv))
            else:
github gluster / glusterfs / geo-replication / syncdaemon / resource.py View on Github external
def get_glusterprog(cls):
            return os.path.join(gconf.gluster_command_dir, cls.glusterprog)