server_admintools package

Submodules

server_admintools.gitlab module

server_admintools.gitlab.backup_repos()

Clones all repositories from a gitlab instance for a user and tars the directories together :return: None

server_admintools.gitlab.create_backup()

Performs the Gitlab Backup. Requires sudo permissions. After creating and renaming the backup, changes the ownership to the specified user :return: None

server_admintools.gitlab.create_config_tarball(destination_file)

Creates a tarball containing the gitlab instance’s secrets and config :return: None

server_admintools.gitlab.execute_gitlab_rake_backup()

Executes the gitlab-rake command that creates a backup file in the location specified in the gitlab.rb config file :return: None

server_admintools.gitlab.fetch_gitlab_clone_script()

Downloads the latest version of the gitlab-cloner script :return: None

server_admintools.gitlab.parse_backup_args()

Parses the arguments for the gitlab-backup script :return: The arguments provided via the CLI

server_admintools.gitlab.parse_clone_repo_args()

Parses the arguments for the git repository cloner :return: The parsed CLI arguments

server_admintools.rsync module

server_admintools.rsync.execute_ssh_rsync_backup(user, source_server, source_path, destination, port=22)

Executes an rsync backup over SSH :param user: The user that logs on using SSH :param source_server: The source server name/IP address :param source_path: The path on the source machine :param destination: The path on the destination machine :param port: The port over which to connect, defaults to 22 :return: None

server_admintools.rsync.parse_ssh_rsync_backup_args()

Parses the CLI for the information required for an Rsync backup :return: None

server_admintools.rsync.run_ssh_rsync_backup()

Runs the Rsync backup using the CLI data :return: None

server_admintools.sudo module

server_admintools.sudo.change_ownership(path, user)

Changes the ownership of a file or directory :param path: The path of the file or directory

whose owner should be changed
Parameters:user – The new owner of the file or directory
Returns:None
server_admintools.sudo.is_sudo()

Checks if the current user has root privileges :return: True if the user has the privileges, False otherwise

server_admintools.sudo.quit_if_not_sudo()

Quits the program in case the user does not have root privileges :return: None

Module contents