1

I'm trying to run below Puppet manifest to set 'IST' timezone.

class { 'timezone':
  timezone => 'IST',
}

When I run Puppet apply timezone.pp, it installs properly. But when I check the system date, It's the same as before. I don't see any change in timezone. Also when I change IST to PST or some other timezone, it works properly. Only IST is not working for me.

I had installed timezone Puppet module and kept it in /etc/puppet/module directory.

What am I missing?

  • 1
    @slm India Standard Time, e.g. India/Calcutta. – Mikel Feb 13 '14 at 7:42
  • @slm : still not able to change after using India/Calcutta. – Nitesh B. Feb 13 '14 at 7:46
  • Perhaps one of the other ones I've added to my answer. I'm not sure what's located where. – slm Feb 13 '14 at 7:49
  • How about India/Kolkata? – Mikel Feb 13 '14 at 8:04
  • Sorry, make that Asia/Kolkata. – Mikel Feb 13 '14 at 8:15
2

I believe you need to use the timezone formats that are shown when you run this command:

$ timedatectl list-timezones | head -4
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers

Perhaps one of these would work for IST:

$ timedatectl list-timezones | grep "^Ind"
Indian/Antananarivo
Indian/Chagos
Indian/Christmas
Indian/Cocos
Indian/Comoro
Indian/Kerguelen
Indian/Mahe
Indian/Maldives
Indian/Mauritius
Indian/Mayotte
Indian/Reunion

Or try this timezone suggested by @Mikel, which was left in the comments:

$ timedatectl list-timezones  | grep -i kol
Asia/Kolkata

Looking at this example from Puppet Forge, saz/timezone:

Set timezone to UTC
    class { 'timezone':
        timezone => 'UTC',
    }
Set timezone to Europe/Berlin
    class { 'timezone':
        timezone => 'Europe/Berlin',
    }

Ruby + tzinfo

Best I can tell the Puppet module is just making use of Ruby's tzinfo gem. If you fire up irb:

$ irb
> require 'tzinfo'
=> true
>

If I try and make use of either "IST" or "India/Calcutta" it throws an exception:

> tz = TZInfo::Timezone.get('India/Calcutta')
TZInfo::InvalidTimezoneIdentifier: no such file to load -- tzinfo/definitions/India/Calcutta
    from /home/saml/.rvm/gems/ruby-1.9.2-p180/gems/tzinfo-0.3.29/lib/tzinfo/timezone.rb:125:in `rescue in get'
    from /home/saml/.rvm/gems/ruby-1.9.2-p180/gems/tzinfo-0.3.29/lib/tzinfo/timezone.rb:100:in `get'
    from (irb):7
    from /home/saml/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'

But if I use one of the other timezone strings I mentioned:

> tz = TZInfo::Timezone.get('Indian/Comoro')
 => #<TZInfo::DataTimezone: Indian/Comoro> 
> 
| improve this answer | |
  • as I already mentioned, other timezones like PST and UTC are working fine for me but not IST. – Nitesh B. Feb 13 '14 at 7:45
  • I'm not surprised that UTC works, that's shown in all the examples. – slm Feb 13 '14 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.