Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-05-02 10:58:43 +0300
committerRémy Coutable <remy@rymai.me>2018-05-02 10:58:43 +0300
commit3f9bfb0ccc99a8a9f1f0b7aa2057c6bcd97d383c (patch)
tree84d1949e3486b4b0a9ca4b4f0fa4088ca9d0b8ae
parentaaf2f902d9982697fee53d032d24c8c55609a6ba (diff)
parentb26a3f91b801c77db21f87a796943b862df3621d (diff)
Merge branch 'blackst0ne-rails5-fix-tzinfo-invalid-timezone-identifier' into 'master'
[Rails5] Fix `TZInfo::InvalidTimezoneIdentifier` exception See merge request gitlab-org/gitlab-ce!18640
-rw-r--r--lib/gitlab/ci/cron_parser.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ci/cron_parser.rb b/lib/gitlab/ci/cron_parser.rb
index 551483d0aaa..73f36735e35 100644
--- a/lib/gitlab/ci/cron_parser.rb
+++ b/lib/gitlab/ci/cron_parser.rb
@@ -6,7 +6,7 @@ module Gitlab
def initialize(cron, cron_timezone = 'UTC')
@cron = cron
- @cron_timezone = ActiveSupport::TimeZone.find_tzinfo(cron_timezone).name
+ @cron_timezone = timezone_name(cron_timezone)
end
def next_time_from(time)
@@ -24,6 +24,12 @@ module Gitlab
private
+ def timezone_name(timezone)
+ ActiveSupport::TimeZone.find_tzinfo(timezone).name
+ rescue TZInfo::InvalidTimezoneIdentifier
+ timezone
+ end
+
# NOTE:
# cron_timezone can only accept timezones listed in TZInfo::Timezone.
# Aliases of Timezones from ActiveSupport::TimeZone are NOT accepted,