#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +-----------------------------------------------------------------+
# |                                                                 |
# |        (  ___ \     | \    /\|\     /||\     /|( (    /|        |
# |        | (   ) )    |  \  / /| )   ( || )   ( ||  \  ( |        |
# |        | (__/ /     |  (_/ / | |   | || (___) ||   \ | |        |
# |        |  __ (      |   _ (  | |   | ||  ___  || (\ \) |        |
# |        | (  \ \     |  ( \ \ | |   | || (   ) || | \   |        |
# |        | )___) )_   |  /  \ \| (___) || )   ( || )  \  |        |
# |        |/ \___/(_)  |_/    \/(_______)|/     \||/    )_)        |
# |                                                                 |
# | Copyright Bastian Kuhn 2020                mail@bastian-kuhn.de |
# +-----------------------------------------------------------------+
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.



def bake_puppet_agent(opsys, conf, conf_dir, plugins_dir):
    source = cmk.utils.paths.local_agents_dir
    if opsys == 'linux':
        source += '/plugins/puppet_agent.sh'
        target = plugins_dir + "/puppet_agent.sh"
    elif opsys == 'windows':
        source += '/plugins/puppet_agent.ps1'
        target = plugins_dir + "/puppet_agent.ps1"
    else:
        raise ValueError("Invalid OS")
    shutil.copy2(source, target)

bakery_info["puppet_agent"] = {
    "bake_function" : bake_puppet_agent,
    "os"            : ["linux", "windows"],
}
