This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |