puppet: suppress puppet warnings with ruby 2.7.

Ubuntu Focal comes with ruby 2.7 and the latest puppet
has some issues with it so to suppress puppet
warnings with ruby 2.7 we added  RUBYOPT = "-W0" in
the environment.
This commit is contained in:
arpit551
2020-05-21 02:12:10 +05:30
committed by Tim Abbott
parent 669f482b0d
commit 3971824d04

View File

@@ -20,8 +20,8 @@ if len(extra_args) and extra_args[0] in ('-f', '--force'):
config = configparser.RawConfigParser()
config.read("/etc/zulip/zulip.conf")
distro_info = parse_os_release()
if not os.path.exists("/etc/puppet/hiera.yaml"):
distro_info = parse_os_release()
if (distro_info['ID'], distro_info['VERSION_ID']) in [('debian', '9'), ('ubuntu', '16.04')]:
# Suppress warnings in old puppet about hiera.yaml not existing.
open("/etc/puppet/hiera.yaml", "a").close()
@@ -43,6 +43,10 @@ puppet_cmd += extra_args
puppet_env = os.environ.copy()
puppet_env["FACTER_zulip_scripts_path"] = scripts_path
# This is to suppress puppet warnings with ruby 2.7.
if (distro_info['ID'], distro_info['VERSION_ID']) in [('ubuntu', '20.04')]:
puppet_env["RUBYOPT"] = "-W0"
if not force:
subprocess.check_call(puppet_cmd + ['--noop', '--show_diff'], env=puppet_env)