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

Make timezone recipe/lwrp less noisy #11

Merged
merged 2 commits into from
Apr 16, 2015
Merged

Make timezone recipe/lwrp less noisy #11

merged 2 commits into from
Apr 16, 2015

Conversation

szymonpk
Copy link
Contributor

I've noticed race condition between chef-client and reconfigure tzdata, every chef run /etc/localtime was recreated and cron restarted. If you accept this I can update metadata.rb.

  * template[/etc/timezone] action create
    - update content in file /etc/timezone from f0dcac to 7e5f76
    --- /etc/timezone 2015-04-15 07:30:54.263510327 +0000
    +++ /tmp/chef-rendered-template20150415-16772-1xzmonp 2015-04-15 07:37:50.915510327 +0000
    @@ -1,2 +1,2 @@
    -Etc/UTC
    +UTC
  * link[/etc/localtime] action create
    - unlink existing symlink to file at /etc/localtime
    - create symlink at /etc/localtime to /usr/share/zoneinfo/UTC
  * service[cron] action restart
    - restart service service[cron]
  * ruby_block[verify linked timezone] action run
    - execute the ruby block verify linked timezone
  • while plain 'UTC' is used as default, reconfigure tzdata is executed and file content is replaced with 'Etc/UTC' + newline, thus chef is recreating file during next run with 'UTC' again
  • timezone attribute was never used
  • /etc/localtime template was replaced with file, it's just one line
  • new line was added to end of /etc/localtime

- while plain 'UTC' is used as default, reconfigure tzdata is executed and
 file content is replaced with 'Etc/UTC' + newline, thus chef is recreating
file during next run with 'UTC' again
- timezone attribute was never used
- /etc/localtime template was replaced with file, it's just one line
- new line was added to /etc/localtime
@flaccid
Copy link
Contributor

flaccid commented Apr 15, 2015

@szymonpk thanks, I did notice this for some time but didn't get around to addressing it. Before we get into dialog can you get it to pass the basic travis testing (rubocop)?

@szymonpk
Copy link
Contributor Author

Sure, I'll try to do later.

@szymonpk
Copy link
Contributor Author

@flaccid builds are passing now.

flaccid added a commit that referenced this pull request Apr 16, 2015
Make timezone recipe/lwrp less noisy
@flaccid flaccid merged commit 38b46c5 into xhost-cookbooks:master Apr 16, 2015
@flaccid
Copy link
Contributor

flaccid commented Apr 16, 2015

@szymonpk thanks. I've merged this, however I'd like to test it a bit more before we release a new version. Not sure if a timezone change is working. We'll also add in at least one unit test for it.

@flaccid flaccid added the bug label Apr 16, 2015
@flaccid flaccid self-assigned this Apr 16, 2015
flaccid added a commit that referenced this pull request Apr 16, 2015
 - remove un-needed include_recipe for cron::default as initialization of the resource already does it
 - remove the default for the timezone attribute of the resource as its a name_attribute
 - support providing a zone with a space instead of underscore (for the humans)
 - make before and after tz-info log resources debug log level
 - fail if an invalid timezone is provided
 - fix not actually setting the timezone when the user sets system/timezone attribute
@flaccid
Copy link
Contributor

flaccid commented Apr 16, 2015

Ok I have fixed it up now. Now we just need a bunch of tests before we release new version :)
I'd also like to add more to the readme.

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

Successfully merging this pull request may close these issues.

2 participants