Drop the AGPL license in favor of a source-available license. See the blog post [1] for details. [1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
46 lines
1.1 KiB
Python
Executable File
46 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright 2016-present ScyllaDB
|
|
#
|
|
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
|
|
import argparse
|
|
import sys
|
|
import yaml
|
|
|
|
|
|
def get(config, key):
|
|
s = open(config).read()
|
|
cfg = yaml.safe_load(s)
|
|
try:
|
|
val = cfg[key]
|
|
except KeyError:
|
|
print("key '%s' not found" % key)
|
|
sys.exit(1)
|
|
if isinstance(val, list):
|
|
for v in val:
|
|
print("%s" % v)
|
|
elif isinstance(val, dict):
|
|
for k, v in list(val.items()):
|
|
print("%s:%s" % (k, v))
|
|
else:
|
|
print(val)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='scylla.yaml config reader/writer from shellscript.')
|
|
parser.add_argument('-c', '--config', dest='config', action='store',
|
|
default='/etc/scylla/scylla.yaml',
|
|
help='path to scylla.yaml')
|
|
parser.add_argument('-g', '--get', dest='get', action='store',
|
|
required=True, help='get parameter')
|
|
args = parser.parse_args()
|
|
get(args.config, args.get)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|