Skip to content

Instantly share code, notes, and snippets.

import subprocess
import sys
import json
def run(cmd, output=True, shell=True):
print(cmd)
if output:
return subprocess.check_output(cmd, shell=shell).strip()
return subprocess.call(cmd, stderr=subprocess.PIPE,
stdout=subprocess.PIPE, shell=shell)
@g-ramirez
g-ramirez / recover_machine_agents.py
Last active November 13, 2020 19:17 — forked from tpsilva/recover_machine_agents.py
Recover juju machine agents
#!/usr/bin/env python
"""
This is a tool for recovering lost machine units in current model
Usage:
{0} model-name dest-dir
"""
# changes summary:
# added logic to prevent overwrite /var/lib/juju to avoid removing non-machine units
#!/bin/bash -eu
#
# Origin: https://gist.github.com/dosaboy/c04fce37b99990bd1994da90e8e72e7e
#
# Authors:
# - edward.hope-morley@canonical.com
# - opentastic@gmail.com
#
# This must be executed on a node that has access to the Openstack apis.
#