Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: get_django_setting_slow returns nil if there are no deploy dirs.

Alex Vandiverea2c37cf50ce
diff --git a/puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb b/puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb
index c20bf488536..86273b95c9c 100644
--- a/puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb
+++ b/puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb
@@ -8,19 +8,18 @@ require "open3"
Puppet::Functions.create_function(:get_django_setting_slow) do
def get_django_setting_slow(name)
- if File.exist?("/etc/zulip/settings.py")
- if Dir.exist?("/home/zulip/deployments/current")
- deploy_dir = "current"
- else
- # First puppet runs during install don't have a "current" yet, only a "next"
- deploy_dir = "next"
- end
- output, _stderr, status = Open3.capture3("/home/zulip/deployments/#{deploy_dir}/scripts/get-django-setting", name)
- if status.success?
- output.strip
- else
- nil
- end
+ return nil unless File.exist?("/etc/zulip/settings.py")
+ if Dir.exist?("/home/zulip/deployments/current")
+ deploy_dir = "current"
+ elsif Dir.exist?("/home/zulip/deployments/next")
+ # First puppet runs during install don't have a "current" yet, only a "next"
+ deploy_dir = "next"
+ else
+ return nil
+ end
+ output, _stderr, status = Open3.capture3("/home/zulip/deployments/#{deploy_dir}/scripts/get-django-setting", name)
+ if status.success?
+ output.strip
else
nil
end