more cleaning

This commit is contained in:
termie 2013-11-19 22:23:49 -08:00
parent 8469db41eb
commit 7d795d23ef
8 changed files with 68 additions and 167 deletions

View File

@ -14,8 +14,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""
"""
import sys import sys
import argparse import argparse
from textwrap import dedent from textwrap import dedent
@ -138,6 +136,7 @@ def start(args):
db.commit() db.commit()
''' '''
def status(args): def status(args):
"""get the status of a running test """get the status of a running test
@ -323,6 +322,7 @@ def subcommands(subparsers):
dest='cloud_id', dest='cloud_id',
help='The id of the cloud you want a config for') help='The id of the cloud you want a config for')
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
@ -364,6 +364,5 @@ def main():
sys.exit(1) sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -1,15 +0,0 @@
#
# Copyright (c) 2013 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,69 +0,0 @@
#
# Copyright (c) 2013 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.v2_0 import client
from refstack.common import *
import refstack.models
class Clouds
class Cloud(object):
""" Cloud functions"""
cloud_id = None
def __init__(self, cloud_id = None):
""" init method loads specified id or fails"""
self.cloud_id = cloud_id
if not cloud_id:
# we have a new cloud.
# do nothing because now we'll call the add method
return None
else:
# load an existing cloud
self._cloud = models.Cloud.query.filter_by(id=self.cloud_id).first()
if not self._cloud:
# cloud not found.. invalid id
# maybe I should do someting about this ..
return None
self._keystone = client.Client(username=self._cloud.admin_user,
password=self._cloud.admin_key,
auth_url=self._cloud.admin_endpoint )
self._end_point = None
def add(self,endpoint,test_user,test_key,
admin_endpoint,admin_user,admin_key,vendor_id=None):
#adds a new cloud to the db
models.db.session.add(Cloud(endpoint,test_user,test_key,
admin_endpoint,admin_user,admin_key,vendor_id))
models.db.session.commit()
@property
def end_point(self):
"""end_point property"""
return self._end_point
@end_point.setter
def end_point(self, value):
self._end_point = value
def get_config(self):
"""uses end_point and creditials from the specified cloud_id to
get a list of services and enpoints from keystone then outputs a
usable tempest config"""

View File

@ -17,7 +17,6 @@ from keystoneclient.v2_0 import client
from refstack.models import * from refstack.models import *
class TempestConfig(object): class TempestConfig(object):
"""temptest config options. gets converted to a tempest config file""" """temptest config options. gets converted to a tempest config file"""
config = {} config = {}
@ -45,7 +44,6 @@ class TempestConfig(object):
# maybe I should do someting about this .. # maybe I should do someting about this ..
return None return None
# This stuff we know before hitting up keystone # This stuff we know before hitting up keystone
self.config['identity']['uri'] = self._cloud.admin_endpoint self.config['identity']['uri'] = self._cloud.admin_endpoint
self.config['identity']['admin_username'] = self._cloud.admin_user self.config['identity']['admin_username'] = self._cloud.admin_user
@ -95,7 +93,6 @@ class TempestConfig(object):
return self.output() return self.output()
def __init__(self, cloud_id): def __init__(self, cloud_id):
""" sets up the default configs""" """ sets up the default configs"""
self.cloud_id = cloud_id self.cloud_id = cloud_id

View File

@ -14,11 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os import os
import sys
import errno
from subprocess import call from subprocess import call
from textwrap import dedent
from refstack.app import app
from refstack.common.tempest_config import TempestConfig from refstack.common.tempest_config import TempestConfig
import testrepository.repository.file import testrepository.repository.file
from testrepository import ui from testrepository import ui
@ -27,6 +23,7 @@ from testrepository.commands import init
import gear import gear
class TesterWorker(object): class TesterWorker(object):
"""gearman worker code""" """gearman worker code"""
def __init__(self,app): def __init__(self,app):
@ -46,7 +43,6 @@ class TesterWorker(object):
job.sendWorkComplete(job.arguments.reverse()) job.sendWorkComplete(job.arguments.reverse())
class TestRepositoryUI(ui.AbstractUI): class TestRepositoryUI(ui.AbstractUI):
"""nothing""" """nothing"""
def __init__(self, here): def __init__(self, here):
@ -57,7 +53,6 @@ class TestRepositoryUI(ui.AbstractUI):
self.here = here self.here = here
class TestRepositorySource(object): class TestRepositorySource(object):
"""Get test results from a testrepository. """Get test results from a testrepository.
@ -111,7 +106,6 @@ class TestRepositorySource(object):
return repo.get_test_run(repo.latest_id()).get_subunit_stream() return repo.get_test_run(repo.latest_id()).get_subunit_stream()
class Tester(object): class Tester(object):
""" Test functions""" """ Test functions"""
test_id = None test_id = None
@ -141,7 +135,6 @@ class Tester(object):
# start tests against cloud_id using sha of tempest # start tests against cloud_id using sha of tempest
# no sha indicates trunk # no sha indicates trunk
def run_local(self): def run_local(self):
"""triggers local run""" """triggers local run"""
# make sure we have a folder to put a repo in.. # make sure we have a folder to put a repo in..
@ -208,12 +201,9 @@ group_regex=([^\.]*\.)*"""
with open(path+".testr.conf", "w") as testr_config_file: with open(path+".testr.conf", "w") as testr_config_file:
testr_config_file.write(testr_output) testr_config_file.write(testr_output)
def cancel(self): def cancel(self):
""" cancels a running test""" """ cancels a running test"""
@property @property
def status(self): def status(self):
"""The status property.""" """The status property."""
@ -225,7 +215,6 @@ group_regex=([^\.]*\.)*"""
del self._status del self._status
return locals() return locals()
@property @property
def config(self): def config(self):
"""The config property. outputs a tempest config based on settings""" """The config property. outputs a tempest config based on settings"""