# Path: opennode/knot/backend/compute.py
# @defer.inlineCallbacks
# def register_machine(host, mgt_stack=IManageable):
# 
#     @db.ro_transact
#     def check():
#         machines = db.get_root()['oms_root']['machines']
#         machine = follow_symlinks(machines['by-name'][host])
#         if not mgt_stack.providedBy(machine):
#             return
#         return machine
# 
#     @db.transact
#     def update():
#         machines = db.get_root()['oms_root']['machines']
#         machine = Compute(unicode(host), u'active', mgt_stack=mgt_stack)
#         machine.__name__ = str(uuid5(NAMESPACE_DNS, host))
#         machines.add(machine)
#         return machine.__name__
# 
#     if not (yield check()):
#         defer.returnValue((yield update()))
# 
# Path: opennode/knot/model/backend.py
# class IKeyManager(Interface):
# 
#     def get_accepted_machines(self):
#         pass
# 
#     def import_machines(self, accepted):
#         pass
# 
# Path: opennode/knot/model/machines.py
# class IncomingMachines(ReadonlyContainer):
#     __name__ = 'incoming'
# 
# class BaseIncomingMachines(ReadonlyContainer):
#     """Template method abstract class for stack-specific incoming machines list implementations"""
# 
#     def _get(self):
#         """ Provide list of incoming host names """
#         raise NotImplemented
# 
#     @property
#     def _items(self):
#         items = self._get()
#         pending = dict((h, IncomingMachineRequest(h)) for h in items)
#         return pending
# 
# Path: opennode/knot/model/compute.py
# class ISaltInstalled(IManageable):
#     """Marker for SaltStack-controlled computes."""


import logging
import subprocess
from grokcore.component import context, implements, name, GlobalUtility
    from salt.config import master_config
    from salt.key import Key
    from salt.utils.parsers import ConfigDirMixIn
from twisted.internet import defer
from opennode.knot.backend.compute import register_machine
from opennode.knot.model.backend import IKeyManager
from opennode.knot.model.machines import IncomingMachines, BaseIncomingMachines
from opennode.knot.model.compute import ISaltInstalled
from opennode.oms.config import get_config
from opennode.oms.model.model.base import ContainerInjector
from __future__ import absolute_import


try:
except ImportError:
    # Allow missing salt on local machine
    master_config = lambda x: None


# Path: opennode/knot/backend/compute.py
# @defer.inlineCallbacks
# def register_machine(host, mgt_stack=IManageable):
# 
#     @db.ro_transact
#     def check():
#         machines = db.get_root()['oms_root']['machines']
#         machine = follow_symlinks(machines['by-name'][host])
#         if not mgt_stack.providedBy(machine):
#             return
#         return machine
# 
#     @db.transact
#     def update():
#         machines = db.get_root()['oms_root']['machines']
#         machine = Compute(unicode(host), u'active', mgt_stack=mgt_stack)
#         machine.__name__ = str(uuid5(NAMESPACE_DNS, host))
#         machines.add(machine)
#         return machine.__name__
# 
#     if not (yield check()):
#         defer.returnValue((yield update()))
# 
# Path: opennode/knot/model/backend.py
# class IKeyManager(Interface):
# 
#     def get_accepted_machines(self):
#         pass
# 
#     def import_machines(self, accepted):
#         pass
# 
# Path: opennode/knot/model/machines.py
# class IncomingMachines(ReadonlyContainer):
#     __name__ = 'incoming'
# 
# class BaseIncomingMachines(ReadonlyContainer):
#     """Template method abstract class for stack-specific incoming machines list implementations"""
# 
#     def _get(self):
#         """ Provide list of incoming host names """
#         raise NotImplemented
# 
#     @property
#     def _items(self):
#         items = self._get()
#         pending = dict((h, IncomingMachineRequest(h)) for h in items)
#         return pending
# 
# Path: opennode/knot/model/compute.py
# class ISaltInstalled(IManageable):
#     """Marker for SaltStack-controlled computes."""


# Path: opennode/knot/backend/salt/machines.py
import logging
import subprocess
from grokcore.component import context, implements, name, GlobalUtility
    from salt.config import master_config
    from salt.key import Key
    from salt.utils.parsers import ConfigDirMixIn
from twisted.internet import defer
from opennode.knot.backend.compute import register_machine
from opennode.knot.model.backend import IKeyManager
from opennode.knot.model.machines import IncomingMachines, BaseIncomingMachines
from opennode.knot.model.compute import ISaltInstalled
from opennode.oms.config import get_config
from opennode.oms.model.model.base import ContainerInjector

from __future__ import absolute_import


try:
except ImportError:
    # Allow missing salt on local machine
    master_config = lambda x: None


    class ConfigDirMixIn(object):