[PUP-9914] v6.7.0 Breaks camptocamp-postfix Created: 2019/07/23  Updated: 2019/08/06  Resolved: 2019/07/25

Status: Resolved
Project: Puppet
Component/s: None
Affects Version/s: PUP 6.7.0
Fix Version/s: PUP 6.7.2

Type: Bug Priority: Critical
Reporter: Grant Davies Assignee: Gheorghe Popescu
Resolution: Fixed Votes: 8
Labels: resolved-issue-added
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 18.04 LTS


Issue Links:
Duplicate
is duplicated by PA-2808 Error: Could not prefetch mailalias p... Resolved
is duplicated by PA-2820 Since upgrading to puppet agent 6.7.0... Resolved
Template:
Acceptance Criteria:

puppet apply -e 'include ::postfix' should install and configure Postfix as it used to previously, and still works in v6.6.0

Team: Night's Watch
Sprint: NW - 2019-08-07
Method Found: Needs Assessment
Release Notes: Bug Fix
Release Notes Summary: Fixed the regression introduced by https://github.com/puppetlabs/puppet/pull/7424 after which puppet was unable to parse files correctly, resulting in errors like: Could not prefetch mailalias provider 'aliases': Could not parse line "mailer-daemon: postmaster" (file: /etc/aliases, line: 12)
QA Risk Assessment: Needs Assessment

 Description   

The new version (v6.7.0) of the puppet-agent has introduced a regression that has broken our MTA (Postfix), based on the camptocamp-postfix module.
 
Steps to reproduce on Ubuntu 18.04 LTS:
```
wget https://apt.puppetlabs.com/puppet6-release-bionic.deb
dpkg -i puppet6-release-bionic.deb
apt update;apt install -y puppet-agent
puppet module install camptocamp-postfix --version 1.8.0
puppet apply -e 'include ::postfix'
```
Output: Error: Could not prefetch mailalias provider 'aliases': Could not parse line "postmaster:    root" (file: /etc/aliases, line: 3)
Error: Failed to apply catalog: Could not parse line "postmaster:    root" (file: /etc/aliases, line: 3)



 Comments   
Comment by Josh Cooper [ 2019/07/23 ]

This regression was introduced in

# git bisect bad
6c257fc7827989c2af2901f974666f0f23611153 is the first bad commit
commit 6c257fc7827989c2af2901f974666f0f23611153
Author: Jorie Tappa <jorie@jorietappa.com>
Date: Mon Sep 24 15:10:09 2018 -0500
 
(maint) Fix simple Lint/AssignmentInConditional rubocop violations.
 
:100644 100644 093fa4bb8260ecd3e38fcdcc8033eb88c1ad89b3 f398c0facb0846d2aef45f2ace36cf2410bc2bf0 M.rubocop.yml
:040000 040000 7fa7aa0b5ed0245ac41d4b61e79c97af01b2cf32 3d666b6e6f93a3bee310bbcc60878c0dabdbd0ec Mbenchmarks
:040000 040000 fc2d5854adc54bb3f6d7fe754e8eb4c99d78c45c 100b46b390d22dd7d7067fb3be4bfb79fce2238d Mext
:040000 040000 6079b6577a3479a29522852d224ef10e0263c824 dd09a84d213d4d2a5dbc1af7a280609d6f6f1642 Mlib
:040000 040000 e6c91ee0cb64f3ea44556917aae7f7d5e4d8c9d8 5bfa8902890939837d72ffa8b59e5b5ea8f3a146 Mspec

Comment by Josh Cooper [ 2019/07/23 ]

Error: Could not prefetch mailalias provider 'aliases': Could not parse line "postmaster:    root" (file: /etc/aliases, line: 3)
/root/puppet/lib/puppet/util/fileparsing.rb:260:in `block in parse'
/root/puppet/lib/puppet/util/fileparsing.rb:252:in `collect'
/root/puppet/lib/puppet/util/fileparsing.rb:252:in `parse'
/root/puppet/lib/puppet/provider/parsedfile.rb:329:in `retrieve'
/root/puppet/lib/puppet/provider/parsedfile.rb:282:in `prefetch_target'
/root/puppet/lib/puppet/provider/parsedfile.rb:274:in `block in prefetch_all_targets'
/root/puppet/lib/puppet/provider/parsedfile.rb:273:in `each'
/root/puppet/lib/puppet/provider/parsedfile.rb:273:in `prefetch_all_targets'
/root/puppet/lib/puppet/provider/parsedfile.rb:226:in `prefetch'
/root/puppet/lib/puppet/transaction.rb:364:in `prefetch'
/root/puppet/lib/puppet/transaction.rb:256:in `prefetch_if_necessary'
/root/puppet/lib/puppet/transaction.rb:111:in `block in evaluate'

Comment by Josh Cooper [ 2019/07/23 ]

This section of code is inside the last else block, but it's supposed to be outside all of the if/then/else logic.

diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 22da68f684..dff5f2de14 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -223,13 +223,13 @@ module Puppet::Util::FileParsing
           ret[last_field] = val
         end
       end
-  
-      if ret
-        ret[:record_type] = record.name
-        return ret
-      else
-        return nil
-      end
+    end
+
+    if ret
+      ret[:record_type] = record.name
+      return ret
+    else
+      return nil
     end
   end
 

Comment by Alexander Heimann [ 2019/07/24 ]

We have the same problem with CentOS 7.6

Comment by Benedikt Sterzinger [ 2019/07/24 ]

Same issue here.

Comment by Ketan Patel [ 2019/07/24 ]

same issue here.

RHEL 7.6

Error: Could not prefetch mailalias provider 'aliases': Could not parse line "mailer-daemon: <email>" (file: /etc/aliases, line: 12)
Error: Failed to apply catalog: Could not parse line "mailer-daemon: <email>" (file: /etc/aliases, line: 12)

Comment by Josh Cooper [ 2019/07/24 ]

FYI, we've merged a fix for this issue (https://github.com/puppetlabs/puppet/commit/ce76a749ccadc5fbddd58122bb9a55be36e17d9c) and we should have a 6.7.1 release out soon.

Comment by Vadym Chepkov [ 2019/07/25 ]

I don't think the issue is specific to postfix module. Anyone using mailalias resource type is affected.

Generated at Thu Nov 21 02:47:01 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.