From 8ef9127ffd76b5b716f26c09dc59a52e5c544972 Mon Sep 17 00:00:00 2001 From: Jonathan Clarke Date: Mon, 23 Nov 2015 18:31:35 +0100 Subject: [PATCH] Fixes #7436: Techniques that call _logger, _logger_default or logger_rudder will break because these methods take 4 arguments now and no upgrade path has been planned --- tree/30_generic_methods/_logger.cf | 43 ++++++++++++++++++++++ tree/30_generic_methods/_logger_default.cf | 41 +++++++++++++++++++++ tree/30_generic_methods/logger_rudder.cf | 40 ++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 tree/30_generic_methods/_logger.cf create mode 100644 tree/30_generic_methods/_logger_default.cf create mode 100644 tree/30_generic_methods/logger_rudder.cf diff --git a/tree/30_generic_methods/_logger.cf b/tree/30_generic_methods/_logger.cf new file mode 100644 index 000000000..85b7e79a2 --- /dev/null +++ b/tree/30_generic_methods/_logger.cf @@ -0,0 +1,43 @@ +##################################################################################### +# Copyright 2013-5 Normation SAS +##################################################################################### +# +# 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, Version 3. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +##################################################################################### + +# @name Logger - legacy interface (DEPRECATED) +# @description Standard logging output. This interface is for compatiblity with older generic methods and techniques, and is replaced by _log. +# +# @parameter message The common part of the message to display +# @parameter old_class_prefix The prefix of the class for different states (0.x version) +# @parameter origin_class_prefix The prefix of the class for different states (1.x version) +# @parameter args The arguments used to call the generic method (slist) +# +# @class_prefix +# @class_parameter old_class_prefix +# The three states are kept, repaired and not_ok +# (as defined in the classes_generic of the cfengine_stdlib) + +bundle agent _logger(message, old_class_prefix, origin_class_prefix, args) +{ + vars: + "empty_slist" slist => { cf_null }; + + methods: + "legacy _logger wrapper" usebundle => _log("${message}", "${old_class_prefix}", "", @{empty_slist}); + + reports: + cfengine:: + "WARNING: DEPRECATED _logger interface called. Please use _log instead (${old_class_prefix}: ${message})"; +} diff --git a/tree/30_generic_methods/_logger_default.cf b/tree/30_generic_methods/_logger_default.cf new file mode 100644 index 000000000..58df4a344 --- /dev/null +++ b/tree/30_generic_methods/_logger_default.cf @@ -0,0 +1,41 @@ +##################################################################################### +# Copyright 2013-5 Normation SAS +##################################################################################### +# +# 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, Version 3. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +##################################################################################### + +# @name Logger default - legacy interface (DEPRECATED) +# @description Standard default logging output. This interface is for compatiblity with older generic methods and techniques, and is replaced by _log_default. +# +# @parameter message The common part of the message to display +# @parameter old_class_prefix The prefix of the class for different states (0.x version) +# @parameter origin_class_prefix The prefix of the class for different states (1.x version) +# @parameter args The arguments used to call the generic method (slist) +# +# @class_prefix _logger_default +# @class_parameter old_class_prefix +# The three states are kept, repaired and not_ok +# (as defined in the classes_generic of the cfengine_stdlib) + +bundle agent _logger_default(message, old_class_prefix, origin_class_prefix, args) +{ + + methods: + "legacy _logger_default wrapper" usebundle => _log_default("${message}", "${old_class_prefix}", "", ""); + + reports: + cfengine:: + "WARNING: DEPRECATED _logger_default interface called. Please use _log_default instead (${old_class_prefix}: ${message})"; +} diff --git a/tree/30_generic_methods/logger_rudder.cf b/tree/30_generic_methods/logger_rudder.cf new file mode 100644 index 000000000..1fe378885 --- /dev/null +++ b/tree/30_generic_methods/logger_rudder.cf @@ -0,0 +1,40 @@ +##################################################################################### +# Copyright 2015 Normation SAS +##################################################################################### +# +# 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, Version 3. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +##################################################################################### + +# @name Logger for Rudder - legacy interface (DEPRECATED) +# @description Logging output for Rudder reports. This interface is for compatiblity with older generic methods and techniques, and is replaced by log_rudder. +# +# @parameter message The common part of the message to display +# @parameter old_class_prefix The prefix of the class for different states (0.x version, empty to force new style logging only) +# +# @class_prefix logger_rudder +# @class_parameter old_class_prefix +# The three states are kept, repaired and not_ok +# (as defined in the classes_generic of the cfengine_stdlib) + +bundle agent logger_rudder(message, old_class_prefix) +{ + + methods: + "legacy logger_rudder wrapper" usebundle => log_rudder("${message}", "${old_class_prefix}", "", ""); + + reports: + cfengine:: + "WARNING: DEPRECATED logger_rudder interface called. Please use log_rudder instead (${old_class_prefix}: ${message})"; + +}