Exemplo n.º 1
0
    def setup_method(self, method):
        self.config = Config()
        self.config.plugins = Config()

        # TODO: this is fragile as it may depend on the dir the tests were run from
        self.config.plugins[
            'aminator.plugins.provisioner.apt'] = self.config.from_file(
                yaml_file=
                'aminator/plugins/provisioner/default_conf/aminator.plugins.provisioner.apt.yml'
            )

        log.info(self.config.plugins)
        self.plugin = AptProvisionerPlugin()

        self.plugin._config = self.config

        config = self.plugin._config.plugins[
            'aminator.plugins.provisioner.apt']

        # use /tmp if not configured, ideally to use tempfile, but needs C build
        self.full_path = os.path.join(
            config.get('mountpoint', '/tmp'),
            config.get('policy_file_path', '/usr/sbin'),
            config.get('policy_file', 'policy-rc.d'))

        self.plugin._root_mountspec = MountSpec(
            None, None, config.get('mountpoint', '/tmp'), None)

        # cleanup
        if os.path.isfile(self.full_path):
            os.remove(self.full_path)
 def setup_method(self, method):
     self.chef_provisioner = AptChefProvisionerPlugin()
     self.chef_provisioner._config = Config()
     self.chef_provisioner._config.context = Config()
     self.chef_provisioner._config.context.chef = Config()
     self.chef_provisioner._config.context.package = Config()
     self.chef_provisioner._config.pkg_attributes = ['name', 'version', 'release', 'build_job', 'build_number']
     self.chef_provisioner._config.context.chef.dir = "./tests"
     self.chef_provisioner._config.context.chef.json = "test_chef_node.json"