def config_file(string):
"""
- Create a config file
+ Create a config file
:param string: name of yaml file used for config.
:returns: Dictionary of configuration information.
def get_http_log_path(archive_dir, job_id=None):
"""
:param archive_dir: directory to be searched
- :param job_id: id of job that terminates the name of the log path
+ :param job_id: id of job that terminates the name of the log path
:returns: http log path
"""
http_base = config.archive_server
def roles_of_type(roles_for_host, type_):
"""
Generator of roles.
-
+
Each call returns the next possible role of the type specified.
:param roles_for host: list of roles possible
:param type_: type of role
def num_instances_of_type(cluster, type_):
"""
Total the number of instances of the role type specified in all remotes.
-
+
:param cluster: Cluster extracted from ctx.
- :param type_: role
+ :param type_: role
"""
remotes_and_roles = cluster.remotes.items()
roles = [roles for (remote, roles) in remotes_and_roles]
def gen_addresses():
"""
Monitor address generator.
-
+
Each invocation returns the next monitor address
"""
for section, data in conf.iteritems():
)
-def sudo_write_file(remote, path, data, perms=None):
+def sudo_write_file(remote, path, data, perms=None, owner=None):
"""
Write data to a remote file as super user
:param path: Path on the remote being written to.
:param data: Data to be written.
:param perms: Permissions on the file being written
+ :param owner: Owner for the file being written
+
+ Both perms and owner are passed directly to chmod.
"""
permargs = []
if perms:
permargs = [run.Raw('&&'), 'sudo', 'chmod', perms, path]
+ owner_args = []
+ if owner:
+ owner_args = [run.Raw('&&'), 'sudo', 'chown', owner, path]
remote.run(
args=[
'sudo',
'-c',
'import shutil, sys; shutil.copyfileobj(sys.stdin, file(sys.argv[1], "wb"))',
path,
- ] + permargs,
+ ] + owner_args + permargs,
stdin=data,
)
Sample dev information: /dev/sdb: /dev/disk/by-id/wwn-0xf00bad
- :returns: map of devices to device id links
+ :returns: map of devices to device id links
"""
stdout = None
try: