Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh-mcollective-metadata cron job broken syntax #360

Open
jeffreyfroman-temboo opened this issue Dec 14, 2017 · 6 comments
Open

refresh-mcollective-metadata cron job broken syntax #360

jeffreyfroman-temboo opened this issue Dec 14, 2017 · 6 comments

Comments

@jeffreyfroman-temboo
Copy link

Line 31 of yaml.pp installs a cron job with broken syntax since switching from facter to puppet facts. The command is fine when run manually, but is broken in cron thanks to the use of the % character as a delimiter in the sed expression.

From man 5 crontab:

       The  ``sixth''  field (the rest of the line) specifies the command to be run.  The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of  the  crontab file.   Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.

Using @ instead should work fine.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.9
  • Ruby: 2.3.1p112
  • Distribution: Ubuntu 16.04
  • Module version: 2.10.6

How to reproduce (e.g Puppet code you use)

Apply yaml.pp, wait 15 minutes, see error emailed by cron.

What are you seeing

/bin/sh: 1: Syntax error: Unterminated quoted string

What behaviour did you expect instead

Successful command execution and population of facts.yaml

Output log

Any additional information you'd like to impart

@ekohl
Copy link
Member

ekohl commented Dec 14, 2017

Would you be able to put a PR together to fix this?

@jeffreyfroman-temboo
Copy link
Author

jeffreyfroman-temboo commented Dec 14, 2017

This seems to have been handled in 8050f53, I'm just confused as to which version I need I guess to get this fix, or more to the point how it got into the version tag I am using. Some of our installations using the same versions still contain the old cron job, using facter

@jeffreyfroman-temboo
Copy link
Author

So my apologies, but I'm not sure I understand where this needs to be pulled into as yet.

@ekohl
Copy link
Member

ekohl commented Dec 14, 2017

Github points on in that commit that it's included in the v3.1.0 git tag. That would be my first try.

@jeffreyfroman-temboo
Copy link
Author

Well, I don't have an issue finding the fix; the problem is that puppet on Ubuntu is pulling this in via apt, and yaml.pp has changed in a previous tag (2.10.6). Once the version is tagged, it shouldn't change, should it? That version used to use facter, but recently switched to the broken puppet facts command.

@alexjfisher
Copy link
Member

@ekohl I think the code has been broken ever since the move to puppet facts. See #361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants