Page MenuHomePhabricator

puppet compiler runs fail when backup::host is included on host
Closed, ResolvedPublic

Description

If you try to test a puppet change in the puppet compiler and the host you run it on happens to include backup::host to have Bacula backups, the compiler run always fails, also before the change.

example:

http://puppet-compiler.wmflabs.org/1560/gallium.wikimedia.org/

also in "production" before the change: http://puppet-compiler.wmflabs.org/1560/gallium.wikimedia.org/prod.gallium.wikimedia.org.err

The error is Failed to parse inline template: undefined method %' for nil:NilClass ` and comes from manifests/role/backup.pp:35

and the line that causes it is: $day = inline_template('<%= @days[[@uniqueid].pack("H*").unpack("L")[0] % 7] -%>')

Note how there is an "%" before the template ends with -%>. That probably breaks it.

Is that escapable? Why does this happen in the compiler but not in real production?

Event Timeline

Dzahn raised the priority of this task from to Needs Triage.
Dzahn updated the task description. (Show Details)
Dzahn added projects: Puppet, SRE.
Dzahn subscribed.
Dzahn set Security to None.
Dzahn added subscribers: akosiaris, Joe.

That's the modulo operator and is meant to make sure we get something between 0 and 6. The problem is that the module operator can not be applied to nil which happens because in the puppet compiler the uniqueid fact is set to 42. Setting it to 8 characters instead of 2 should fix that. That code does some byte to hex and then to int computations hence the issue.

https://gerrit.wikimedia.org/r/#/c/260910/2/modules/puppetmaster/files/puppet-facts-export,cm

Change 265233 had a related patch set uploaded (by Alexandros Kosiaris):
puppet-facts-export: Set an 8 byte uniqueid

https://gerrit.wikimedia.org/r/265233

Change 265233 merged by Alexandros Kosiaris:
puppet-facts-export: Set an 8 byte uniqueid

https://gerrit.wikimedia.org/r/265233

akosiaris claimed this task.

and now that the above change was merged and the facts updated (manually as always), https://puppet-compiler.wmflabs.org/1631/ succeeds. Resolving