#arguments to this should be ${sullivan/access/token/id} ${sullivan/access/user/id}
''' Performs a recursive http request to create keys on every cloud '''

import json
import os
import requests
import sys

from logging_settings import get_logger
from subprocess import Popen, PIPE

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../local')
import local_settings

#logging settings
LOGGER = get_logger()

HOST = '%s:%s' % (local_settings.API_HOST, local_settings.NOVA_PROXY_PORT)

HEADERS = {
    'Host': HOST,
    'Accept': 'application/json',
    'User-Agent': 'python-novaclient',
    'Content-Type': 'application/json',
    'Accept-Encoding': 'gzip, deflate'
}


def create_keypair(project_id, auth_token, name, cloud, public_key=None):
    ''' Recursively call the nova proxy with a os-keypairs create key request
    '''
示例#2
0
import json
import os
import random
import requests
import sys

from ConfigParser import ConfigParser
from logging_settings import get_logger
from psycopg2 import IntegrityError
from subprocess import Popen, PIPE

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../local')
import local_settings

#logging settings 
logger = get_logger()

class connect_error():
    ''' little stub so we can polymorph on the error '''
    def __init__(self):
        self.status_code = 500

def get_instances(project_id, auth_token):
    ''' query the api for instances '''

    host = '%s:%s' % (local_settings.API_HOST, local_settings.NOVA_PROXY_PORT)

    url = "http://%s/v2/%s/servers/detail" % (host, project_id)

    headers = {
        "X-Auth-Project-Id": project_id,