Skip to content

Commit

Permalink
Fixes #7436: Techniques that call _logger, _logger_default or logger_…
Browse files Browse the repository at this point in the history
…rudder will break because these methods take 4 arguments now and no upgrade path has been planned
  • Loading branch information
jooooooon committed Nov 23, 2015
1 parent 0af889f commit 8ef9127
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tree/30_generic_methods/_logger.cf
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
#####################################################################################

# @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})";
}
41 changes: 41 additions & 0 deletions tree/30_generic_methods/_logger_default.cf
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
#####################################################################################

# @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})";
}
40 changes: 40 additions & 0 deletions tree/30_generic_methods/logger_rudder.cf
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
#####################################################################################

# @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})";

}

0 comments on commit 8ef9127

Please sign in to comment.