summaryrefslogtreecommitdiffstats
path: root/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/cfg/base.py
blob: 68608d1b4c2f069ff3554cd39417270404838c23 (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
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The base class for all resource modules
"""

from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network import (
    get_resource_connection,
)


class ConfigBase(object):
    """ The base class for all resource modules
    """

    ACTION_STATES = ["merged", "replaced", "overridden", "deleted"]

    def __init__(self, module):
        self._module = module
        self.state = module.params["state"]
        self._connection = None

        if self.state not in ["rendered", "parsed"]:
            self._connection = get_resource_connection(module)