Example #1
0
    def test_create(self):
        """Tests creating tree."""
        os.listdir.side_effect = [
            ['testing'],
            ['testing'],
        ]

        tree = spawn_tree.Tree('/does/not/exist', 2, 5)
        tree.create()

        self.assertEquals(8, fs.mkdir_safe.call_count)
        self.assertEquals(6, utils.create_script.call_count)
        self.assertEquals(2, shutil.rmtree.call_count)
Example #2
0
    def test_create(self):
        """Tests creating tree."""
        os.listdir.side_effect = [
            ['testing'],
            ['testing'],
        ]

        tree = spawn_tree.Tree('/does/not/exist', 2, 5)
        tree.create()

        self.assertEqual(1, supervisor.create_environ_dir.call_count)
        self.assertEqual(8, fs.mkdir_safe.call_count)
        self.assertEqual(6, templates.create_script.call_count)
        self.assertEqual(2, shutil.rmtree.call_count)
Example #3
0
    def install(self):
        """Installs the spawn services."""
        wipe_me = os.path.join(self.dst_dir, 'wipe_me')
        wipe_me_sh = os.path.join(self.dst_dir, 'bin', 'wipe_spawn.sh')

        _LOGGER.debug('wipe_me: %s, wipe_me.sh: %s', wipe_me, wipe_me_sh)
        if os.path.exists(wipe_me):
            _LOGGER.info('Requested clean start, calling: %s', wipe_me_sh)
            os.system(wipe_me_sh)
        else:
            _LOGGER.info('Preserving treadmill data, no clean restart.')

        super(SpawnBootstrap, self).install()

        spawn_tree.Tree(self.dst_dir).create()
Example #4
0
 def start_tree_cmd(approot):
     """Starts the spawn tree."""
     tree = spawn_tree.Tree(approot)
     tree.create()
     tree.run()