Esempio n. 1
0
    def load_from_file(self, name):
        path = os.path.abspath(name)

        parser = self.case_parser_class()
        try:
            test = parser.parse(path)
        except SyntaxError, err:
            msger.error('%s:%s' % (name, err))
Esempio n. 2
0
    def setup(self, suite, env):
        if not self._acquire_lock():
            msger.error("another instance is working on this workspace(%s) "
                        "since the lock file(%s) exist. please run ps to "
                        "check." % (self.workdir, self.lockname))
            return False

        self._setup(suite, env)
        return True
Esempio n. 3
0
def mkdir_in_remote(url):
    parts = url.split('@', 1)
    if len(parts) > 1:
        username, host_and_path = parts
    else:
        host_and_path = parts[0]
        username = ''
    host, path = host_and_path.split(':', 1)
    userhost = '%s@%s' % (username, host) if username else host

    cmd = "ssh '%s' mkdir -p '%s'" % (userhost, path)
    msger.debug(cmd)
    if os.system(cmd) != 0:
        msger.error("can't mkdir %s in remote server %s" % (path, userhost))
Esempio n. 4
0
    def _acquire_lock(self):
        if os.path.exists(self.lockname):
            return False

        # race condition here, but i simply ignore this
        path = self.workdir
        if os.path.exists(path):
            msger.info('removing old test space %s' % path)
            if sudo('rm -rf %s' % path) != 0:
                msger.error("can't clean old workspace, please fix manually")

        os.mkdir(path)
        open(self.lockname, 'w').close()
        self._locked = True
        return True
Esempio n. 5
0
        deps.extend([
            'build-mkdrpms',
            'perl-Crypt-SSLeay',
            ])
    else:
        deps.extend([
            'perl-Crypt-SSLeay',
            ])
    return deps

# set osc certifications
OSC_CERT_DIR = os.path.expanduser('~/.config/osc/trusted-certs')
OSC_CERT_FROM = os.path.join(os.environ["ITEST_ENV_PATH"], 'fixtures', 'conf_fixtures')
OSC_CERTS = [name.split('/')[-1] for name in glob(r'%s/api.*_443.pem' % OSC_CERT_FROM)]

if not os.path.exists(OSC_CERT_DIR):
    os.makedirs(OSC_CERT_DIR)

try:
    for osc_cert in OSC_CERTS:
        if not os.path.exists(os.path.join(OSC_CERT_DIR, osc_cert)):
            shutil.copy(os.path.join(OSC_CERT_FROM, osc_cert), OSC_CERT_DIR)
except Exception, err:
    msger.error(str(err))

TARGET_NAME = 'gbs'
TARGET_VERSION = get_version()
DEPENDENCIES = get_dependencies()

SUDO_PASSWD = os.environ.get('ITEST_SUDO_PASSWD', '123456')