summaryrefslogtreecommitdiffstats
path: root/commands/ccs_disable_rg.py
blob: af378699bad434372855780fb6382a831ad44c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: UTF-8 -*-
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""ccs-disable-rg command"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

from ..command import Command
from ..protocol import protocols
from ..utils_cman import PATH_CLUSTERCONF


@Command.deco(('ccs-disable-rg',
                   ('ccs-version-bump')))
def ccs_disable_rg(cmd_ctxt,
                   input=PATH_CLUSTERCONF,
                   output="cluster-disabledrg-{ccs-disable-rg.in.hash}.conf",
                   noversionbump=False):
    """Make config. prevent RGManager from (accidentally) starting

    Options:
        input          input CMAN-based cluster configuration file
        output         output file with RGManager being declaratively disabled
        noversionbump  prevent incrementing in-document configuration version
    """
    if noversionbump:
        cmd_ctxt['filter_noop'].append('ccs-version-bump')

    file_proto = protocols.plugins['file'].ensure_proto
    return (
        file_proto(input),
        (
            file_proto(output),
        ),
    )