# Path: igor/log.py
# def configure(fn):
# def backlog():
# def getLogger(name):
# 
# Path: igor/utils.py
# def run(cmd, with_retval=False):
# def dict_to_args(d):
# def cmdline_to_dict(cmdline):
#     def __init__(self, f):
#     def __enter__(self):
#     def __exit__(self, typ, value, traceback):
#     def mount(self, iso):
#     def umount(self):
#     def mount(self, iso):
#     def umount(self):
#     def mount(self, iso):
#     def umount(self):
# def surl(number):
#     def __init__(self, cleanfiles=[]):
#     def __enter__(self):
#     def __exit__(self, typ, value, traceback):
#     def cleanfile(self, f):
#     def clean(self):
# def scanf(pat, txt):
# def synchronized(lock):
#     def wrap(f):
#         def newFunction(*args, **kw):
# def xor(a, b):
# def parse_bool(s):
#     def __init__(self, interval=10):
#     def _debug(self, msg):
#     def run(self):
#     def stop(self):
#     def is_stopped(self):
#     def work(self):
#     def __init__(self, n):
#     def transition(self, val):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# def obj2xml(root, obj, as_string=False):
#     def __open(filename, fileobj=None):
#     def __read_yaml(filename, fileobj=None):
# def update_properties_only(obj, kwargs):
# class MountedArchive:
# class GvfsMountedArchive(MountedArchive):
# class LosetupMountedArchive(MountedArchive):
# class TemporaryDirectory:
# class PollingWorkerDaemon(threading.Thread):
# class State(object):
# class Factory(object):
# 
# Path: igor/daemon/main.py
# class UpdateableObject(object):
# class Host(UpdateableObject):
# class Profile(UpdateableObject):
# class Origin(object):
# class Inventory(object):
# class JobSpec(UpdateableObject):
# class Testplan(object):
# class Testsuite(object):
# class Testset(object):
# class Testcase(object):
# class TestSession(UpdateableObject):
#     def __init__(self, **kwargs):
#     def update_props(self, kwargs):
#     def prepare(self):
#     def start(self):
#     def get_name(self):
#     def get_mac_address(self):
#     def purge(self):
#     def __to_dict__(self):
#     def get_name(self):
#     def assign_to(self, host, additional_kargs=""):
#     def enable_pxe(self, enable):
#     def kargs(self, kargs):
#     def revoke_from(self, host):
#     def delete(self):
#     def __repr__(self):
#     def __to_dict__(self):
#     def name(self):
#     def items(self):
#     def lookup(self, name):
#     def create_item(self, **kwargs):
#     def __to_dict__(self):
#     def __init__(self, plans={}, testsuites={}, profiles={}, hosts={}):
#     def _add_origins(self, k, origins):
#     def _items(self, k):
#     def _lookup(self, k, q=None):
#     def plans(self, q=None):
#     def testsuites(self, q=None):
#     def profiles(self, q=None):
#     def hosts(self, q=None):
#     def check(self):
#     def create_profile(self, oname, pname, kernel, initrd, kargs):
#     def __to_dict__(self):
#     def __str__(self):
#     def __init__(self, name, job_layouts, inventory=None):
#     def timeout(self):
#     def job_specs(self):
#     def spec_from_layout(self, layout):
#     def _parse_toplevel_field_value(self, key, value):
#     def __str__(self):
#     def __to_dict__(self):
#     def __hash__(self):
#     def __init__(self, name, testsets=[]):
#     def testcases(self):
#     def libs(self):
#     def timeout(self):
#     def __str__(self):
#     def __to_dict__(self):
#     def get_archive(self, subdir="testcases"):
#     def __add_testcases_to_archive(self, archive, subdir):
#     def __add_testcase_to_archive(self, archive, arcname, testcase):
#     def __add_data_to_archive(self, archive, arcname, data):
#     def __add_libs_to_archive(self, archive, subdir):
#     def validate(self):
#     def __init__(self, name, testcases=[], libs=None):
#     def testcases(self):
#     def libs(self, libs=None):
#     def timeout(self):
#     def add(self, cs):
#     def __str__(self):
#     def __to_dict__(self):
#     def __init__(self, filename=None, name=None):
#     def source(self):
#     def __str__(self):
#     def __to_dict__(self):
#     def __init__(self, cookie, session_path, cleanup=True):
#     def remove(self):
#     def remove_artifacts(self):
#     def __artifacts_path(self, name=""):
#     def add_artifact(self, name, data):
#     def get_artifact(self, name):
#     def artifacts(self, use_abs=False):
#     def get_artifacts_archive(self, selection=None):
#     def __enter__(self):
#     def __exit__(self, _type, value, traceback):


from igor import log, utils
from igor.daemon import main
import glob
import os
import tarfile
import tempfile
import yaml



logger = log.getLogger(__name__)


def initialize_origins(category, CONFIG):
    origins = []

    superorigin = TestDraftSuperOrigin(tempfile.mkdtemp())

    if category == "testplan":
        origins += [("draft-files",
                     superorigin.get_testplans_origin()),
                    ("files",
                     TestplansOrigin(CONFIG["testplans"]["paths"]))]

    if category == "testsuite":
        origins += [("draft-files",
                     superorigin.get_testsuites_origin()),
                    ("files",
                     TestsuitesOrigin(CONFIG["testcases"]["paths"]))]

    if category == "host":
        origins += [("files",
                     HostsOrigin(CONFIG["hosts"]["paths"]))]

    return origins



# Path: igor/log.py
# def configure(fn):
# def backlog():
# def getLogger(name):
# 
# Path: igor/utils.py
# def run(cmd, with_retval=False):
# def dict_to_args(d):
# def cmdline_to_dict(cmdline):
#     def __init__(self, f):
#     def __enter__(self):
#     def __exit__(self, typ, value, traceback):
#     def mount(self, iso):
#     def umount(self):
#     def mount(self, iso):
#     def umount(self):
#     def mount(self, iso):
#     def umount(self):
# def surl(number):
#     def __init__(self, cleanfiles=[]):
#     def __enter__(self):
#     def __exit__(self, typ, value, traceback):
#     def cleanfile(self, f):
#     def clean(self):
# def scanf(pat, txt):
# def synchronized(lock):
#     def wrap(f):
#         def newFunction(*args, **kw):
# def xor(a, b):
# def parse_bool(s):
#     def __init__(self, interval=10):
#     def _debug(self, msg):
#     def run(self):
#     def stop(self):
#     def is_stopped(self):
#     def work(self):
#     def __init__(self, n):
#     def transition(self, val):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# def obj2xml(root, obj, as_string=False):
#     def __open(filename, fileobj=None):
#     def __read_yaml(filename, fileobj=None):
# def update_properties_only(obj, kwargs):
# class MountedArchive:
# class GvfsMountedArchive(MountedArchive):
# class LosetupMountedArchive(MountedArchive):
# class TemporaryDirectory:
# class PollingWorkerDaemon(threading.Thread):
# class State(object):
# class Factory(object):
# 
# Path: igor/daemon/main.py
# class UpdateableObject(object):
# class Host(UpdateableObject):
# class Profile(UpdateableObject):
# class Origin(object):
# class Inventory(object):
# class JobSpec(UpdateableObject):
# class Testplan(object):
# class Testsuite(object):
# class Testset(object):
# class Testcase(object):
# class TestSession(UpdateableObject):
#     def __init__(self, **kwargs):
#     def update_props(self, kwargs):
#     def prepare(self):
#     def start(self):
#     def get_name(self):
#     def get_mac_address(self):
#     def purge(self):
#     def __to_dict__(self):
#     def get_name(self):
#     def assign_to(self, host, additional_kargs=""):
#     def enable_pxe(self, enable):
#     def kargs(self, kargs):
#     def revoke_from(self, host):
#     def delete(self):
#     def __repr__(self):
#     def __to_dict__(self):
#     def name(self):
#     def items(self):
#     def lookup(self, name):
#     def create_item(self, **kwargs):
#     def __to_dict__(self):
#     def __init__(self, plans={}, testsuites={}, profiles={}, hosts={}):
#     def _add_origins(self, k, origins):
#     def _items(self, k):
#     def _lookup(self, k, q=None):
#     def plans(self, q=None):
#     def testsuites(self, q=None):
#     def profiles(self, q=None):
#     def hosts(self, q=None):
#     def check(self):
#     def create_profile(self, oname, pname, kernel, initrd, kargs):
#     def __to_dict__(self):
#     def __str__(self):
#     def __init__(self, name, job_layouts, inventory=None):
#     def timeout(self):
#     def job_specs(self):
#     def spec_from_layout(self, layout):
#     def _parse_toplevel_field_value(self, key, value):
#     def __str__(self):
#     def __to_dict__(self):
#     def __hash__(self):
#     def __init__(self, name, testsets=[]):
#     def testcases(self):
#     def libs(self):
#     def timeout(self):
#     def __str__(self):
#     def __to_dict__(self):
#     def get_archive(self, subdir="testcases"):
#     def __add_testcases_to_archive(self, archive, subdir):
#     def __add_testcase_to_archive(self, archive, arcname, testcase):
#     def __add_data_to_archive(self, archive, arcname, data):
#     def __add_libs_to_archive(self, archive, subdir):
#     def validate(self):
#     def __init__(self, name, testcases=[], libs=None):
#     def testcases(self):
#     def libs(self, libs=None):
#     def timeout(self):
#     def add(self, cs):
#     def __str__(self):
#     def __to_dict__(self):
#     def __init__(self, filename=None, name=None):
#     def source(self):
#     def __str__(self):
#     def __to_dict__(self):
#     def __init__(self, cookie, session_path, cleanup=True):
#     def remove(self):
#     def remove_artifacts(self):
#     def __artifacts_path(self, name=""):
#     def add_artifact(self, name, data):
#     def get_artifact(self, name):
#     def artifacts(self, use_abs=False):
#     def get_artifacts_archive(self, selection=None):
#     def __enter__(self):
#     def __exit__(self, _type, value, traceback):


# Path: igor/daemon/backends/files.py
from igor import log, utils
from igor.daemon import main
import glob
import os
import tarfile
import tempfile
import yaml




logger = log.getLogger(__name__)


def initialize_origins(category, CONFIG):
    origins = []

    superorigin = TestDraftSuperOrigin(tempfile.mkdtemp())

    if category == "testplan":
        origins += [("draft-files",
                     superorigin.get_testplans_origin()),
                    ("files",
                     TestplansOrigin(CONFIG["testplans"]["paths"]))]

    if category == "testsuite":
        origins += [("draft-files",
                     superorigin.get_testsuites_origin()),
                    ("files",
                     TestsuitesOrigin(CONFIG["testcases"]["paths"]))]

    if category == "host":
        origins += [("files",
                     HostsOrigin(CONFIG["hosts"]["paths"]))]

    return origins



class Host(main.Host):