import os import sys import subprocess import json from optparse import OptionParser import requests from paellaclient.base import get_system_uuid from paellaclient.base import make_identity_request from paellaclient.config import config base_url = config.get('main', 'machines_url') parser = OptionParser() parser.add_option('--recipe', type='string', action='store', dest='recipe', default='') parser.add_option('--name', type='string', action='store', dest='name', default='') parser.add_option('--autoinstall', action='store_true', dest='autoinstall', default=None) parser.add_option('--no-autoinstall',
import os import sys import subprocess import json import requests from paellaclient.config import config base_url = config.get('main', 'machines_url') def get_mac_addresses(interface=''): process = subprocess.Popen(['/sbin/ifconfig'], stdout=subprocess.PIPE) retval = process.wait() if retval: raise RuntimeError , "ifconfig returned %d" % retval if interface: raise RuntimeError , "interface keyword is currently ignored" macs = [] for line in process.stdout: if line.startswith('eth'): # convert to lowercase line = line.lower() columns = [c.strip() for c in line.split()] mac = columns[4].replace(':', '-') # ethernet is ARP 1 type mac = '01-%s' % mac macs.append(mac) return macs # this command uses sudo because # it needs access to read the smbios
import os import sys import subprocess import StringIO import json from optparse import OptionParser import requests from paellaclient.base import get_system_uuid from paellaclient.base import make_identity_request from paellaclient.base import selections_to_dictionary from paellaclient.config import config base_url = config.get('main', 'debrepos_url') parser = OptionParser() opts, args = parser.parse_args(sys.argv[1:]) def get_machine_name(): uuid = get_system_uuid() data = make_identity_request(uuid) return data['name'] #################################################### def poll_process_for_complete_output(cmd):
import os import sys import subprocess import json from optparse import OptionParser import tempfile import requests from paellaclient.base import get_system_uuid from paellaclient.config import config base_url = config.get('main', 'recipes_url') headers = {'Content-type': 'application/json', 'Accept': 'application/json'} if 'EDITOR' in os.environ: editor = os.environ['EDITOR'] else: editor = '/usr/bin/editor' REQUIRED_ARG_COMMANDS = ['create', 'edit', 'delete'] COMMANDS = REQUIRED_ARG_COMMANDS + ['list', 'backup', 'restore'] parser = OptionParser() opts, args = parser.parse_args(sys.argv[1:]) if not len(args): raise RuntimeError, "Improper arguments. Need at least one argument."
import os import sys import subprocess import json from optparse import OptionParser import tempfile import requests from paellaclient.base import get_system_uuid from paellaclient.config import config base_url = config.get('main', 'recipes_url') headers = {'Content-type': 'application/json', 'Accept': 'application/json'} if 'EDITOR' in os.environ: editor = os.environ['EDITOR'] else: editor = '/usr/bin/editor' REQUIRED_ARG_COMMANDS = ['create', 'edit', 'delete'] COMMANDS = REQUIRED_ARG_COMMANDS + ['list', 'backup', 'restore'] parser = OptionParser() opts, args = parser.parse_args(sys.argv[1:]) if not len(args): raise RuntimeError, "Improper arguments. Need at least one argument." command = args[0]
import os import sys import subprocess import StringIO import json from optparse import OptionParser import requests from paellaclient.base import get_system_uuid from paellaclient.base import make_identity_request from paellaclient.base import selections_to_dictionary from paellaclient.config import config base_url = config.get('main', 'debrepos_url') parser = OptionParser() opts, args = parser.parse_args(sys.argv[1:]) def get_machine_name(): uuid = get_system_uuid() data = make_identity_request(uuid) return data['name'] ####################################################