def list_users(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing users.") return service.MongoDBAdmin().list_users(limit, marker, include_marker)
def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" self.app.install_if_needed(packages) self.status.wait_for_database_service_start( self.app.state_change_wait_time) self.app.stop_db() mount_point = CONF.mongodb.mount_point self.app.clear_storage(mount_point) if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): device.migrate_data(mount_point) device.mount(mount_point) operating_system.chown(mount_point, system.MONGO_USER, system.MONGO_USER, as_root=True) LOG.debug("Mounted the volume %(path)s as %(mount)s." % { 'path': device_path, "mount": mount_point }) if config_contents: # Save resolved configuration template first. self.app.configuration_manager.save_configuration(config_contents) # Apply guestagent specific configuration changes. self.app.apply_initial_guestagent_configuration( cluster_config, mount_point) if not cluster_config: # Create the Trove admin user. self.app.secure() # Don't start mongos until add_config_servers is invoked, # don't start members as they should already be running. if not (self.app.is_query_router or self.app.is_cluster_member): self.app.start_db(update_db=True) if not cluster_config and backup_info: self._perform_restore(backup_info, context, mount_point, self.app) if service.MongoDBAdmin().is_root_enabled(): self.app.status.report_root(context, 'root')
def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return service.MongoDBAdmin().is_root_enabled()
def enable_root_with_password(self, context, root_password=None): return service.MongoDBAdmin().enable_root(root_password)
def enable_root(self, context): LOG.debug("Enabling root.") return service.MongoDBAdmin().enable_root()
def list_access(self, context, username, hostname): LOG.debug("Listing access.") return service.MongoDBAdmin().list_access(username)
def grant_access(self, context, username, hostname, databases): LOG.debug("Granting acccess.") return service.MongoDBAdmin().grant_access(username, databases)
def revoke_access(self, context, username, hostname, database): LOG.debug("Revoking access.") return service.MongoDBAdmin().revoke_access(username, database)
def delete_user(self, context, user): LOG.debug("Deleting user.") with EndNotification(context): return service.MongoDBAdmin().delete_user(user)
def get_user(self, context, username, hostname): LOG.debug("Getting user.") return service.MongoDBAdmin().get_user(username)
def delete_database(self, context, database): LOG.debug("Deleting database.") with EndNotification(context): return service.MongoDBAdmin().delete_database(database)
def create_user(self, context, users): LOG.debug("Creating user(s).") with EndNotification(context): return service.MongoDBAdmin().create_users(users)
def create_database(self, context, databases): LOG.debug("Creating database(s).") with EndNotification(context): return service.MongoDBAdmin().create_database(databases)
def update_attributes(self, context, username, hostname, user_attrs): LOG.debug("Updating database attributes.") with EndNotification(context): return service.MongoDBAdmin().update_attributes( username, user_attrs)
def change_passwords(self, context, users): LOG.debug("Changing password.") with EndNotification(context): return service.MongoDBAdmin().change_passwords(users)