dist: suppress the yaml load warning

YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe. Please read https://msg.pyyaml.org/load
for full details.

Fix it by use new safe interface - yaml.safe_load()

Signed-off-by: Amos Kong <amos@scylladb.com>
Cc: Vlad Zolotarov <vladz@scylladb.com>
Message-Id: <9b68601845117274573474ede0341cc81f80efa6.1561156205.git.amos@scylladb.com>
This commit is contained in:
Amos Kong
2019-06-21 23:02:13 +00:00
committed by Avi Kivity
parent fc629bb14f
commit f0cd589a75
6 changed files with 6 additions and 6 deletions

View File

@@ -95,7 +95,7 @@ def tune_fs(path, nomerges):
# tunes all filesystems referenced from a scylla.yaml
def tune_yaml(path, nomerges):
import yaml
y = yaml.load(open(path))
y = yaml.safe_load(open(path))
for fs in y['data_file_directories']:
tune_fs(fs, nomerges)
tune_fs(y['commitlog_directory'], nomerges)

View File

@@ -27,7 +27,7 @@ import yaml
def get(config, key):
s = open(config).read()
cfg = yaml.load(s)
cfg = yaml.safe_load(s)
try:
val = cfg[key]
except KeyError:

View File

@@ -39,7 +39,7 @@ def main():
help='path to scylla.yaml')
args = parser.parse_args()
s = open(args.config).read()
cfg = yaml.load(s)
cfg = yaml.safe_load(s)
mountpoints = set()
for d in cfg['data_file_directories']:
mountpoints.add(find_mount_point(d))

View File

@@ -90,7 +90,7 @@ if __name__ == "__main__":
conf_dir = os.environ["SCYLLA_CONF"]
else:
conf_dir = "/etc/scylla"
cfg = yaml.load(open(os.path.join(conf_dir, "scylla.yaml")))
cfg = yaml.safe_load(open(os.path.join(conf_dir, "scylla.yaml")))
if not "data_file_directories" in cfg:
logging.error("No data directories found. Please check the configuration and run scylla_io_setup again.\n")
sys.exit(1)

View File

@@ -420,7 +420,7 @@ def get_scylla_dirs():
Verifies that mandatory parameters are set.
"""
scylla_yaml_name = '/etc/scylla/scylla.yaml'
y = yaml.load(open(scylla_yaml_name))
y = yaml.safe_load(open(scylla_yaml_name))
# Check that mandatory fields are set
if 'data_file_directories' not in y or \

View File

@@ -39,7 +39,7 @@ class ScyllaSetup:
def io(self):
conf_dir = "/etc/scylla"
cfg = yaml.load(open(os.path.join(conf_dir, "scylla.yaml")))
cfg = yaml.safe_load(open(os.path.join(conf_dir, "scylla.yaml")))
data_dirs = cfg["data_file_directories"]
if len(data_dirs) > 1:
logging.warn("%d data directories found. scylla_io_setup currently lacks support for it, and only %s will be evaluated",