#9854 improve fasjson-aliases script
Opened 10 days ago by kevin. Modified 3 days ago

The fasjson-aliases script takes a template and data from the account system and generates mail aliases.

It currently has 2 bugs we need to fix:

Bug 1: it does not call 'newaliases' after it updates the alias file. This means postfix never updates and uses the new data. It needs to call newaliases on any change.

Bug 2: some groups have no manager or other defined, giving:
postalias: warning: /etc/aliases, line 73371: need name:value pair
postalias: warning: /etc/aliases, line 73383: need name:value pair
postalias: warning: /etc/aliases, line 73384: need name:value pair
postalias: warning: /etc/aliases, line 73407: need name:value pair
postalias: warning: /etc/aliases, line 73408: need name:value pair
postalias: warning: /etc/aliases, line 73491: need name:value pair
postalias: warning: /etc/aliases, line 73492: need name:value pair
postalias: warning: /etc/aliases, line 73494: need name:value pair
postalias: warning: /etc/aliases, line 73545: need name:value pair
postalias: warning: /etc/aliases, line 73546: need name:value pair
postalias: warning: /etc/aliases, line 73629: need name:value pair
postalias: warning: /etc/aliases, line 73630: need name:value pair
postalias: warning: /etc/aliases, line 73635: need name:value pair
postalias: warning: /etc/aliases, line 73636: need name:value pair
postalias: warning: /etc/aliases, line 73647: need name:value pair
postalias: warning: /etc/aliases, line 73648: need name:value pair
postalias: warning: /etc/aliases, line 73662: need name:value pair
postalias: warning: /etc/aliases, line 73686: need name:value pair
postalias: warning: /etc/aliases, line 73687: need name:value pair
postalias: warning: /etc/aliases, line 73692: need name:value pair
postalias: warning: /etc/aliases, line 73693: need name:value pair
postalias: warning: /etc/aliases, line 73719: need name:value pair
postalias: warning: /etc/aliases, line 73737: need name:value pair
postalias: warning: /etc/aliases, line 73738: need name:value pair
postalias: warning: /etc/aliases, line 73740: need name:value pair
postalias: warning: /etc/aliases, line 73741: need name:value pair
postalias: warning: /etc/aliases, line 73743: need name:value pair
postalias: warning: /etc/aliases, line 73744: need name:value pair
postalias: warning: /etc/aliases, line 73764: need name:value pair
postalias: warning: /etc/aliases, line 73765: need name:value pair
postalias: warning: /etc/aliases, line 73773: need name:value pair
postalias: warning: /etc/aliases, line 73774: need name:value pair
postalias: warning: /etc/aliases, line 73788: need name:value pair
so, might be best to filter those out?

I am not sure who wrote the script? @scoady ? or @humaton ?


Metadata Update from @humaton:
- Issue tagged with: dev, low-trouble, medium-gain

10 days ago

I wrote it. I can take a look at the bugs.

Metadata Update from @smooge:
- Issue priority set to: Waiting on Assignee (was: Needs Review)

10 days ago

@smooge you can assign to me if you want, I don't seem to be able to.

Also, it would be helpful if I had one of the examples of a group with no sponsors - is that something you could find from the output posted above? It would just make it easier to test my code before pushing.

Metadata Update from @smooge:
- Issue assigned to scoady

10 days ago

found a group with no members nor sponsors. PR is created and ready for review.

Thanks @scoady that fixed those issues. It now outputs:

postalias: warning: /etc/aliases.db: duplicate entry: "orphan"
postalias: warning: /etc/aliases.db: duplicate entry: "haskell-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "i18n-team"
postalias: warning: /etc/aliases.db: duplicate entry: "java-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "mingwmaint"
postalias: warning: /etc/aliases.db: duplicate entry: "mono-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "ocamlmaint"
postalias: warning: /etc/aliases.db: duplicate entry: "packaging-team"
postalias: warning: /etc/aliases.db: duplicate entry: "upstream-release-monitoring"
postalias: warning: /etc/aliases.db: duplicate entry: "virtmaint"
postalias: warning: /etc/aliases.db: duplicate entry: "fonts-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "gecko-maint"
postalias: warning: /etc/aliases.db: duplicate entry: "hams-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "kernel-maint"
postalias: warning: /etc/aliases.db: duplicate entry: "lvm-team"
postalias: warning: /etc/aliases.db: duplicate entry: "perl-sig"
postalias: warning: /etc/aliases.db: duplicate entry: "xen-maint"
postalias: warning: /etc/aliases.db: duplicate entry: "xgl-maint"

Those are all sigs that own packages...

@kevin I'm not overly familiar with postfix - am I right in saying postfix has already processed an alias for the orphan group? I'm not sure how that's happening as the script should only process each group once. Is there something else making entries?

So if you log into bastion01.iad2.fedoraproject.org and look at the /etc/aliases file you can see what is happening.

$grep xen-maint /etc/aliases
xen-maint: xen-maint@redhat.com
xen-maint: xen-maint@redhat.com 
 ```

something in how this file is being created is creating duplicate pairs.

$ egrep -v '^#|^$' /etc/aliases | awk -F: '{print $1}' | sort | uniq -d
fonts-sig
gecko-maint
hams-sig
haskell-sig
i18n-team
java-sig
kernel-maint
lvm-team
mingwmaint
mono-sig
ocamlmaint
orphan
packaging-team
perl-sig
upstream-release-monitoring
virtmaint
xen-maint
xgl-maint
$ egrep -v '^#|^$' /etc/aliases | awk -F: '{print $1}' | sort | uniq -u | wc -l
76968
```

these groups have been duplicated for some reason over the 76968 other entries which are not duplicated. I hope this helps.

Thanks @smooge. Unfortunately, it doesn't really help because I don't have access to /etc/aliases.

I think I know what the problem is though. Basically, there is a template that this script uses as a base and that template contains some actual users in IPA. Those users obviously get their own alias so there is a duplication. I'll work on this tomorrow and get a fix together as soon as I can.

Login to comment on this ticket.

Metadata
Boards 1
dev Status: Backlog
Related Pull Requests
  • #533 Merged 5 days ago