
from . import myhosts

class Workspace(object):
    def __init__(self, node):
        self._node = node

    def get_targets(self):
        hosts = self._node.get('targets', [])
        hosts = [x for x in hosts if myhosts.is_enabled(x['name'])]
        for host in hosts:
            assert 'name' in host
        return hosts


from . import myhosts

class Workspace(object):
    def __init__(self, node):
        self._node = node

    def get_targets(self):
        hosts = self._node.get('targets', [])
        rr = [x for x in hosts if myhosts.is_enabled(x['name'])]
        rr.extend([x for x in hosts if not myhosts.is_known_host(x['name'])])
        for host in hosts:
            assert 'name' in host
        return hosts

Add containers in hosts so we can rsync into containers
Add containers in hosts so we can rsync into containers
  
  from . import myhosts
  
  class Workspace(object):
      def __init__(self, node):
          self._node = node
  
      def get_targets(self):
          hosts = self._node.get('targets', [])
-         hosts = [x for x in hosts if myhosts.is_enabled(x['name'])]
+         rr = [x for x in hosts if myhosts.is_enabled(x['name'])]
+         rr.extend([x for x in hosts if not myhosts.is_known_host(x['name'])])
          for host in hosts:
              assert 'name' in host
          return hosts
  
Add containers in hosts so we can rsync into containers
## Code Before:

from . import myhosts

class Workspace(object):
    def __init__(self, node):
        self._node = node

    def get_targets(self):
        hosts = self._node.get('targets', [])
        hosts = [x for x in hosts if myhosts.is_enabled(x['name'])]
        for host in hosts:
            assert 'name' in host
        return hosts

## Instruction:
Add containers in hosts so we can rsync into containers
## Code After:

from . import myhosts

class Workspace(object):
    def __init__(self, node):
        self._node = node

    def get_targets(self):
        hosts = self._node.get('targets', [])
        rr = [x for x in hosts if myhosts.is_enabled(x['name'])]
        rr.extend([x for x in hosts if not myhosts.is_known_host(x['name'])])
        for host in hosts:
            assert 'name' in host
        return hosts
