From 20842cf4997dc535567698dc974fe1fc8fd9b96a Mon Sep 17 00:00:00 2001 From: Shawn Davis Date: Thu, 23 Dec 2021 20:14:43 -0600 Subject: [PATCH] Created mappings which merge snippets for Cent and Ubuntu. --- scripttease/library/snippets/mappings.py | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripttease/library/snippets/mappings.py diff --git a/scripttease/library/snippets/mappings.py b/scripttease/library/snippets/mappings.py new file mode 100644 index 0000000..544ec9a --- /dev/null +++ b/scripttease/library/snippets/mappings.py @@ -0,0 +1,55 @@ +# Imports + +from .centos import centos +from .django import django +from .messages import messages +from .mysql import mysql +from .pgsql import pgsql +from .posix import posix +from .python import python +from .ubuntu import ubuntu + +# Exports + +# Functions + + +def merge(first: dict, *others) -> dict: + """Merge all other dictionaries into the first. + + :param first: The first dictionary. + :type first: dict + + :param others: A list of other dictionaries to be merged. + + """ + for d in others: + first = merge_dictionaries(first, d) + + return first + + +def merge_dictionaries(first: dict, second: dict) -> dict: + """Merge the second dictionary into the first. + + :param first: The first dictionary. + :type first: dict + + :param second: The second dictionary. + :type second: dict + + :rtype: dict + + """ + for key, values in second.items(): + first[key] = values + + return first + +# Mappings + + +MAPPINGS = { + 'centos': merge(centos, django, messages, mysql, pgsql, posix, py), + 'ubuntu': merge(ubuntu, django, messages, mysql, pgsql, posix, python), +}