Example #1
0
def do_delete():
    '''Delete default templates in the specified tenant

    Deletion uses the --plugin-name and --plugin-version options
    as filters.

    Only templates with 'is_default=True' will be deleted.
    '''

    ctx = Context(tenant_id=CONF.command.tenant_id)

    for plugin in get_plugin_name():

        kwargs = {'is_default': True}
        kwargs['plugin_name'] = plugin

        # Delete cluster templates first for the sake of usage checks
        lst = conductor.API.cluster_template_get_all(ctx, **kwargs)
        for l in lst:
            if not u.check_plugin_version(l, CONF.command.plugin_version):
                continue
            delete_cluster_template(ctx, l)

        lst = conductor.API.node_group_template_get_all(ctx, **kwargs)
        for l in lst:
            if not u.check_plugin_version(l, CONF.command.plugin_version):
                continue
            delete_node_group_template(ctx, l)
Example #2
0
def do_delete():
    '''Delete default templates in the specified tenant

    Deletion uses the --plugin-name and --plugin-version options
    as filters.

    Only templates with 'is_default=True' will be deleted.
    '''

    ctx = Context(tenant_id=CONF.command.tenant_id)

    for plugin in get_plugin_name():

        kwargs = {'is_default': True}
        kwargs['plugin_name'] = plugin

        # Delete cluster templates first for the sake of usage checks
        lst = conductor.API.cluster_template_get_all(ctx, **kwargs)
        for l in lst:
            if not u.check_plugin_version(l, CONF.command.plugin_version):
                continue
            delete_cluster_template(ctx, l)

        lst = conductor.API.node_group_template_get_all(ctx, **kwargs)
        for l in lst:
            if not u.check_plugin_version(l, CONF.command.plugin_version):
                continue
            delete_node_group_template(ctx, l)
Example #3
0
    def test_check_plugin_version(self):

        template = {"plugin_name": "vanilla", "hadoop_version": "2.6.0"}

        self.assertTrue(utils.check_plugin_version(template, None))
        self.assertTrue(utils.check_plugin_version(template, ["2.6.0"]))
        self.assertTrue(utils.check_plugin_version(template, ["vanilla.2.6.0"]))
        self.assertFalse(utils.check_plugin_version(template, ["1.2.1"]))
Example #4
0
    def test_check_plugin_version(self):

        template = {"plugin_name": "vanilla", "hadoop_version": "2.7.1"}

        self.assertTrue(utils.check_plugin_version(template, None))
        self.assertTrue(utils.check_plugin_version(template, ["2.7.1"]))
        self.assertTrue(utils.check_plugin_version(template,
                                                   ["vanilla.2.7.1"]))
        self.assertFalse(utils.check_plugin_version(template, ["1.2.1"]))