[PUP-8131] Calls to Puppet::Util.benchmark should include a 'in %{seconds} seconds' in there message Created: 2017/11/08  Updated: 2018/02/05  Resolved: 2018/01/02

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 5.3.4

Type: Task Priority: Normal
Reporter: Eric Delaney Assignee: Melissa Stone
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
blocks PUP-7949 I18N Add support feedback when badly ... Closed
relates to PUP-8252 re-enable i18n test after translation... Closed
Acceptance Criteria:
  • Refactor calls to Puppet::Util.benchmark to pass in a complete message string
  • include "in % {seconds}

    seconds" in the string

  • have benchmark() format the string and and set the number of seconds take msg % " { seconds: seconds }
  • ensure tests and CI continue to pass
Epic Link: Agent i18n/l10n testing
Sub-team: Coremunity
Team: Platform Core
Sprint: Platform Core KANBAN
Release Notes: Not Needed
QA Risk Assessment: No Action


The Puppet::Util.benchmark method adds to the message (msg) passed into the method. We should instead find all usages of the method and append the 'in %


to the string passed in so that it can be included in the original translation message rather than appended separately. (like it as below)

object.send(level, msg + (_(" in %0.2f seconds") % seconds))

Making this change will cause the test tests/i18n/check_puppet_run_messages.rb to fail until translation is completed and the translation string in the test is updated (as needed).

Comment by Eric Delaney [ 2017/11/16 ]
  • I looked at the code and most of the cases are easy enough to just add the missing string to the message in the benchmark() call.
  • In one case we'll need to escape % format so that we can process the string once in the method and then again inside of benchmark "ie string % {format_now}

    more string in %%

    {seconds} seconds" so that the "%{seconds}

    will be passed in the string to benchmark to complete the formatting of it

  • The puppet-test string uses benchmark, but none of the strings in it appear to be marked for translation.
Comment by Melissa Stone [ 2017/12/18 ]

Merged into 5.3.x at https://github.com/puppetlabs/puppet/commit/fa13f1a10b718105e98ad2fe523d5bf0fc688e73

Comment by Melissa Stone [ 2018/01/02 ]

Resolving, as CI has passed and there is no action needed for QA risk assessment.

Generated at Fri Aug 07 09:43:25 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.