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

Timezone is not Indempotent #22

Closed
ngtjah opened this issue Jun 21, 2015 · 5 comments
Closed

Timezone is not Indempotent #22

ngtjah opened this issue Jun 21, 2015 · 5 comments
Assignees

Comments

@ngtjah
Copy link

ngtjah commented Jun 21, 2015

I always seem to get "2 resources updated" when using this on centos 6.6.

node.default['system']['timezone'] = "America/Chicago"

include_recipe "system::timezone"

Chef Client finished, 2/6 resources updated in 190.483255071 seconds

Having trouble locating the issue...

[2015-06-21T18:13:58-05:00] DEBUG: Not storing cookbooks/system/resources/timezone.rb, as the cache is up to date.
[2015-06-21T18:13:58-05:00] DEBUG: Not storing cookbooks/system/providers/timezone.rb, as the cache is up to date.
[2015-06-21T18:13:58-05:00] DEBUG: Not storing cookbooks/system/recipes/timezone.rb, as the cache is up to date.
[2015-06-21T18:13:58-05:00] DEBUG: Loading cookbook system's providers from /tmp/kitchen/cache/cookbooks/system/providers/timezone.rb
[2015-06-21T18:13:58-05:00] DEBUG: Loaded contents of /tmp/kitchen/cache/cookbooks/system/providers/timezone.rb into a provider named system_timezone defined in Chef::Provider::SystemTimezone
[2015-06-21T18:13:58-05:00] DEBUG: Loading cookbook system's resources from /tmp/kitchen/cache/cookbooks/system/resources/timezone.rb
[2015-06-21T18:13:58-05:00] DEBUG: Loaded contents of /tmp/kitchen/cache/cookbooks/system/resources/timezone.rb into a resource named system_timezone defined in Chef::Resource::SystemTimezone
[2015-06-21T18:13:58-05:00] DEBUG: Loading Recipe system::timezone via include_recipe
[2015-06-21T18:13:58-05:00] DEBUG: Found recipe timezone in cookbook system
[2015-06-21T18:13:58-05:00] DEBUG: resources for generic system_timezone resource enabled on node include: []
[2015-06-21T18:13:58-05:00] DEBUG: resources for generic system_timezone resource enabled on node include: []
[2015-06-21T18:14:58-05:00] INFO: Processing system_timezone[America/Chicago] action set (system::timezone line 20)
[2015-06-21T18:14:58-05:00] DEBUG: providers for generic system_timezone resource enabled on node include: []
[2015-06-21T18:14:58-05:00] DEBUG: providers that refused resource system_timezone[America/Chicago] were: []
[2015-06-21T18:14:58-05:00] DEBUG: providers that support resource system_timezone[America/Chicago] include: []
[2015-06-21T18:14:58-05:00] WARN: Current  service[cron]: /tmp/kitchen/cache/cookbooks/system/providers/timezone.rb:53:in `block in class_from_file'
[2015-06-21T18:14:58-05:00] INFO: Processing log[tz-info (before set): -0500 CDT] action write (/tmp/kitchen/cache/cookbooks/system/providers/timezone.rb line 29)
[2015-06-21T18:14:58-05:00] DEBUG: providers for generic log resource enabled on node include: [Chef::Provider::Log::ChefLog]
[2015-06-21T18:14:58-05:00] DEBUG: providers that refused resource log[tz-info (before set): -0500 CDT] were: []
[2015-06-21T18:14:58-05:00] DEBUG: providers that support resource log[tz-info (before set): -0500 CDT] include: [Chef::Provider::Log::ChefLog]
[2015-06-21T18:14:58-05:00] DEBUG: providers that survived replacement include: [Chef::Provider::Log::ChefLog]
[2015-06-21T18:14:58-05:00] DEBUG: tz-info (before set): -0500 CDT
[2015-06-21T18:14:58-05:00] INFO: Processing service[cron] action nothing (/tmp/kitchen/cache/cookbooks/system/providers/timezone.rb line 53)
[2015-06-21T18:14:58-05:00] DEBUG: Skipping service[cron] due to only_if ruby block
[2015-06-21T18:14:58-05:00] INFO: Processing link[/etc/localtime] action create (/tmp/kitchen/cache/cookbooks/system/providers/timezone.rb line 61)
[2015-06-21T18:14:58-05:00] DEBUG: providers for generic link resource enabled on node include: [Chef::Provider::Link]
[2015-06-21T18:14:58-05:00] DEBUG: providers that refused resource link[/etc/localtime] were: []
[2015-06-21T18:14:58-05:00] DEBUG: providers that support resource link[/etc/localtime] include: [Chef::Provider::Link]
[2015-06-21T18:14:58-05:00] DEBUG: providers that survived replacement include: [Chef::Provider::Link]
[2015-06-21T18:14:58-05:00] DEBUG: found target_mode == nil, so no mode was specified on resource, not managing mode
[2015-06-21T18:14:58-05:00] DEBUG: found target_uid == nil, so no owner was specified on resource, not managing owner
[2015-06-21T18:14:58-05:00] DEBUG: found target_gid == nil, so no group was specified on resource, not managing group
[2015-06-21T18:14:58-05:00] INFO: Processing ruby_block[verify linked timezone] action nothing (/tmp/kitchen/cache/cookbooks/system/providers/timezone.rb line 67)
[2015-06-21T18:14:58-05:00] DEBUG: Skipping ruby_block[verify linked timezone] due to action :nothing
[2015-06-21T18:14:58-05:00] DEBUG: Saving the current state of node default-homer01
@flaccid
Copy link
Contributor

flaccid commented Jun 22, 2015

I'm not quite sure either. Can you re-test with the latest master commit (72e44c0) and let me know which platform/version this is on?

@flaccid flaccid self-assigned this Jun 22, 2015
@ngtjah
Copy link
Author

ngtjah commented Jun 22, 2015

Ya same results with the latest.

 "platform": "centos",
  "platform_version": "6.6",
  "platform_family": "rhel",

flaccid pushed a commit that referenced this issue Jun 22, 2015
…ezone needs to be changed for idempotency, improve logic around cron service definition for platforms not yet supported in cron cookbook, do not update the timezone resource unless the zone is changed.
@flaccid
Copy link
Contributor

flaccid commented Jun 22, 2015

Ok, learnt a couple of things there with resources i.e. log resources probably always are regarded as updated, don't do updated_by_last_action unless the resource was actually updated.
Please re-open if any issues.

@flaccid flaccid closed this as completed Jun 22, 2015
@flaccid
Copy link
Contributor

flaccid commented Jun 22, 2015

Example run where there is no resources updated:

       Starting Chef Client, version 12.3.0
       [2015-06-23T09:02:04+10:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
       resolving cookbooks for run list: ["system::timezone"]
       Synchronizing Cookbooks:
         - system
         - apt
         - cron
         - hostsfile
       Compiling Cookbooks...
       Converging 3 resources
       Recipe: cron::default
        (up to date)
         * service[cron] action enable (up to date)
        (up to date)
       Recipe: system::timezone
         * system_timezone[Australia/Sydney] action set (up to date)
         * log[tz-info (before set): +1000 AEST] action write (skipped due to only_if)
        (up to date)
         * ruby_block[verify newly-linked timezone] action nothing (skipped due to action :nothing)

       Running handlers:
       Running handlers complete
       Chef Client finished, 0/5 resources updated in 5.222982258 seconds
       Finished converging <default-centos-66> (4m46.95s).

@ngtjah
Copy link
Author

ngtjah commented Jun 23, 2015

That seems to have done the trick. Thanks!

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

2 participants