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

Issue with Variable Evaluation #82

Open
bdwyertech opened this issue Jan 23, 2016 · 2 comments
Open

Issue with Variable Evaluation #82

bdwyertech opened this issue Jan 23, 2016 · 2 comments
Labels
Waiting on Contributor Awaiting on the person who raised this to update

Comments

@bdwyertech
Copy link

For one reason or another, logrotate_app seems to have a problem evaluating Resource Properties.

If I try passing in service_user as create "644 #{service_user} #{service_user}"

  Recipe: <Dynamically Defined Resource>
    * template[/etc/logrotate.d/MyApp] action create
      - update content in file /etc/logrotate.d/MyApp from f37b2e to 2ac241
      --- /etc/logrotate.d/MyApp       2016-01-22 17:44:23.244140684 -0700
      +++ /etc/logrotate.d/.MyApp20160122-28294-36d27x 2016-01-22 17:46:41.888167833 -0700
      @@ -3,7 +3,7 @@

       "/var/log/MyApp/error.log" {
         daily
      -  create 644 root root
      +  create 644 [] []
         rotate 30
         missingok
         delaycompress
    * template[PHP Configuration (MyApp)] action create (up to date)

This doesn't work

Defined as property :service_name, String, name_property: true
  logrotate_app service_name do
    cookbook  'logrotate'
    path [::File.join(log_dir, 'error.log')]
    frequency 'daily'
    options ['missingok', 'delaycompress', 'notifempty']
    postrotate "invoke-rc.d #{service_name}  reopen-logs > /dev/null"
    sharedscripts true
    rotate 30
    create '644 root root'
  end

This Works

  lr_service_name = service_name
  logrotate_app service_name do
    cookbook  'logrotate'
    path [::File.join(log_dir, 'error.log')]
    frequency 'daily'
    options ['missingok', 'delaycompress', 'notifempty']
    postrotate "invoke-rc.d #{lr_service_name}  reopen-logs > /dev/null"
    sharedscripts true
    rotate 30
    create '644 root root'
  end

Finally, if you try to use a lazy evaluator, it passes the lazy evaluator object as a string.

@github-actions
Copy link

github-actions bot commented Jan 8, 2021

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

@github-actions github-actions bot added the Stale This is marked as stale and will be closed shortly label Jan 8, 2021
@bdwyertech
Copy link
Author

I will test this again in the next week or so and see if the issue still exists. Maybe it was a Ruby version issue or something.

@github-actions github-actions bot removed the Stale This is marked as stale and will be closed shortly label Jan 9, 2021
@bmhughes bmhughes added the Waiting on Contributor Awaiting on the person who raised this to update label May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting on Contributor Awaiting on the person who raised this to update
Projects
None yet
Development

No branches or pull requests

2 participants