Merge "Fix pep8 errors"

This commit is contained in:
Jenkins
2015-04-24 08:51:53 +00:00
committed by Gerrit Code Review
4 changed files with 50 additions and 51 deletions

View File

@@ -1,50 +1,49 @@
import os
import sys, getopt
import socket
import sys
import time
import ConfigParser
from novaclient.v1_1 import client as nc
import requests
from random import randint
from keystoneclient.v2_0 import client as kc
from heatclient import client as hc
from heatclient import exc as hc_exc
from cinderclient import client as cc
import re
CONF = dict()
CONF_FILE = '/etc/jenkins_jobs/credentials.conf'
keys = ["os_username", "os_password", "os_auth_url", "os_tenant_name", "os_image_endpoint"]
def load_conf():
# load credentials and configs
config = ConfigParser.ConfigParser()
config.readfp(open(CONF_FILE))
for key, val in config.items("default"):
CONF[key] = val
for item in keys:
CONF[item] = os.environ[item]
for env_item in os.environ:
CONF[env_item] = os.environ[env_item]
def get_nova_client():
return nc.Client(username=CONF["os_username"],
api_key=CONF["os_password"],
auth_url=CONF["os_auth_url"],
project_id = CONF["os_tenant_name"]
)
project_id=CONF["os_tenant_name"])
def get_auth_token():
keystone = kc.Client(username=CONF["os_username"],
password=CONF["os_password"],
tenant_name=CONF["os_tenant_name"],
auth_url = CONF["os_auth_url"]
)
auth_url=CONF["os_auth_url"])
return keystone.auth_token
def get_heat_client():
return hc.Client('1', endpoint=CONF["os_image_endpoint"], token=get_auth_token())
return hc.Client('1',
endpoint=CONF["os_image_endpoint"],
token=get_auth_token())
def get_cinder_client():
return cc.Client('1', CONF["os_username"], CONF["os_password"], CONF["os_tenant_name"], CONF["os_auth_url"])
return cc.Client('1',
CONF["os_username"],
CONF["os_password"],
CONF["os_tenant_name"],
CONF["os_auth_url"])
def cleanup_heat():
current_name = sys.argv[2]
@@ -72,6 +71,7 @@ def cleanup_heat():
print "Performing resources cleanup..."
cleanup()
def cleanup():
client = get_nova_client()
cinder_client = get_cinder_client()
@@ -100,6 +100,7 @@ def cleanup():
print group.name
group.delete()
def main(argv):
load_conf()

View File

@@ -1,4 +0,0 @@
[default]
OS_USERNAME=ci-user
OS_TENANT_NAME=ci
OS_PASSWORD=nova

View File

@@ -6,6 +6,9 @@ sleep 20
source $JENKINS_HOME/credentials
set -x
job_type=$(echo $PREV_JOB | awk -F '-' '{ print $1 }')
export os_username=$os_username
export os_password=$os_password
export os_tenant_name=$os_tenant_name
if [[ "$HOST_NAME" =~ neutron ]]; then
export os_auth_url="http://$OPENSTACK_HOST_NEUTRON_LAB:5000/v2.0"
export os_image_endpoint="http://$OPENSTACK_HOST_NEUTRON_LAB:8004/v1/$NEUTRON_LAB_TENANT_ID"

View File

@@ -2,7 +2,6 @@
source $JENKINS_HOME/credentials
sudo su - jenkins -c "cat $WORKSPACE/slave-scripts/credentials.conf > /etc/jenkins_jobs/credentials.conf"
sudo su - zuul -c "cat $WORKSPACE/config/zuul/zuul.conf > /etc/zuul/zuul.conf"
sudo su - zuul -c "cat $WORKSPACE/config/zuul/gearman-logging.conf > /etc/zuul/gearman-logging.conf"
sudo su - zuul -c "cat $WORKSPACE/config/zuul/layout.yaml > /etc/zuul/layout.yaml"