Expand description
This is a library containing a bunch of routines that I have found useful for setting up and running experiments remotely.
Some of these utilities execute a sequence of steps. They require a shell as input and actually run a command remotely.
The rest only construct a command that can be executed and return it to the caller without executing anything.
There are also some utilities that don’t construct or run commands. They are just useful functions for constructing commands.
The centos and ubuntu submodules contain routines specifically useful for those platforms.
Modules§
- centos
- Functionality specific to Centos, RHEL, Amazon Linux, and other related distros.
- ubuntu
- Functionality specific to Ubuntu.
Functions§
- add_
to_ group - Add the executing user to the given group. Requires
sudopermissions. - create_
partition - Create a new partition on the given device. Requires
sudopermissions. - escape_
for_ bash - Given a string, properly escape the string so that it can be passed as a command line argument to bash.
- format_
partition_ as_ ext4 - Formats and mounts the given device as ext4 at the given mountpoint owned by the given user. The given partition and mountpoint are assumed to be valid (we don’t check). We will assume quite a few things for simplicity:
- get_
dev_ sizes - Returns the human-readable size of the devices
devs. For example,["477G", "500M"]. - get_
host_ ip - Given a host:ip address, return
(host, ip). - get_
mounted_ devs - Returns the list of devices mounted and their mountpoints. For example,
[("sda2", "/")]. - get_
partitions - Returns a list of partitions of the given device. For example,
["sda1", "sda2"]. - get_
unpartitioned_ devs - Returns a list of devices with no partitions. For example,
["sda", "sdb"]. - reboot
- Reboot and wait for the remote machine to come back up again. Requires
sudo. - set_
cpu_ scaling_ governor - Sets the CPU scaling governor to the given governor. This requires
- swapoff
- Turn off the swap device. Requires
sudopermissions. - swapon
- Turn on the swap device. Requires
sudopermissions. Assumes the device is already formatted as a swap device (i.e. withmkswap). - write_
gpt - Write a new general partition table (GPT) on the given device. Requires
sudopermissions.