Example #1
0
    def change_permissions(self):
        """
        When CouchDB is installed, a default user 'couchdb' is created.
        Inorder to start/stop/restart CouchDB service as the current
        OS user, add the current OS user to the 'couchdb' group and provide
        read/write access to the 'couchdb' group.
        """
        try:
            LOG.debug("Changing permissions.")
            for dir in [COUCHDB_LIB_DIR, COUCHDB_LOG_DIR,
                        COUCHDB_BIN_DIR, COUCHDB_CONFIG_DIR]:
                operating_system.chown(dir, 'couchdb', 'couchdb', as_root=True)
                operating_system.chmod(dir, FileMode.ADD_GRP_RW, as_root=True)

            operating_system.change_user_group(getpass.getuser(), 'couchdb',
                                               as_root=True)
            LOG.debug("Successfully changed permissions.")
        except exception.ProcessExecutionError:
            LOG.exception(_("Error changing permissions."))
Example #2
0
    def change_permissions(self):
        """
        When CouchDB is installed, a default user 'couchdb' is created.
        Inorder to start/stop/restart CouchDB service as the current
        OS user, add the current OS user to the 'couchdb' group and provide
        read/write access to the 'couchdb' group.
        """
        try:
            LOG.debug("Changing permissions.")
            for dir in [COUCHDB_LIB_DIR, COUCHDB_LOG_DIR,
                        COUCHDB_BIN_DIR, COUCHDB_CONFIG_DIR]:
                operating_system.chown(dir, 'couchdb', 'couchdb', as_root=True)
                operating_system.chmod(dir, FileMode.ADD_GRP_RW, as_root=True)

            operating_system.change_user_group(getpass.getuser(), 'couchdb',
                                               as_root=True)
            LOG.debug("Successfully changed permissions.")
        except exception.ProcessExecutionError:
            LOG.exception(_("Error changing permissions."))