From 751f12e2226971ed343eb429c8b67a7c3ef5e505 Mon Sep 17 00:00:00 2001 From: charlesvdv Date: Fri, 6 Jan 2017 12:18:40 +0100 Subject: [PATCH] Use UTC timezone --- .travis.yml | 8 ++++++++ .travis/dispatch.sh | 6 ++++++ common/init.sls | 5 +++++ tests/sls/common/__init__.py | 0 tests/sls/common/timezone.py | 18 ++++++++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 tests/sls/common/__init__.py create mode 100644 tests/sls/common/timezone.py diff --git a/.travis.yml b/.travis.yml index d6430ca0..8df1674c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ matrix: os: linux sudo: required dist: trusty + language: python + python: 3.5 - env: - SALT_NODE_ID=servo-mac1 - SALT_FROM_SCRATCH=true @@ -25,6 +27,8 @@ matrix: os: linux sudo: required dist: trusty + language: python + python: 3.5 - env: - SALT_NODE_ID=servo-master1 - SALT_FROM_SCRATCH=true @@ -40,6 +44,8 @@ matrix: os: linux sudo: required dist: trusty + language: python + python: 3.5 - env: - SALT_NODE_ID=servo-mac1 - SALT_FROM_SCRATCH=false @@ -51,6 +57,8 @@ matrix: os: linux sudo: required dist: trusty + language: python + python: 3.5 - env: - SALT_NODE_ID=servo-master1 - SALT_FROM_SCRATCH=false diff --git a/.travis/dispatch.sh b/.travis/dispatch.sh index be94744b..b6639243 100755 --- a/.travis/dispatch.sh +++ b/.travis/dispatch.sh @@ -72,4 +72,10 @@ else if [[ "${SALT_NODE_ID}" == "servo-master1" ]]; then ./test.py sls.buildbot.master sls.homu sls.nginx fi + + # Salt doesn't support timezone.system on OSX + # See https://github.com/saltstack/salt/issues/31345 + if [[ ! "${SALT_NODE_ID}" =~ servo-mac* ]]; then + ./test.py sls.common + fi fi diff --git a/common/init.sls b/common/init.sls index c433ba7f..6210a870 100644 --- a/common/init.sls +++ b/common/init.sls @@ -45,6 +45,11 @@ servo: - shell: /bin/bash - home: {{ common.servo_home }} +{% if grains['os'] != 'MacOS' %} +UTC: + timezone.system +{% endif %} + {% for hostname, ip in common.hosts.items() %} host-{{ hostname }}: host.present: diff --git a/tests/sls/common/__init__.py b/tests/sls/common/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/sls/common/timezone.py b/tests/sls/common/timezone.py new file mode 100644 index 00000000..add0384a --- /dev/null +++ b/tests/sls/common/timezone.py @@ -0,0 +1,18 @@ +import subprocess + +from tests.util import Failure, Success + + +def run(): + ret = subprocess.run( + ['date'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + + stdout = ret.stdout.decode('utf-8') + + if ret.returncode == 0 and 'UTC' in stdout: + return Success('Date is in UTC') + else: + return Failure('Date is not in UTC: ', stdout)