when we set new values by the config.py script
script created also the file ( example - doSet_version1522153623088712.json )
is it possoible to flag the script in way to disable this file creation ?
/var/lib/ambari-server/resources/scripts/configs.py --user=admin --password=admin --port=8080 --action=set --host=master02 --cluster=hdp --config-type=spark2-thrift-sparkconf -k spark.executor.instances -v 8 ls doSet_version1522153623088712.json
if we cant block the file creation then is it possible to write this file on other folder as /var/tmp insted my curent folder ?
just to explain my case , when we run the script more then 100 times then 100 json file created , so we want to avoid the files creation because we run the script under /.../.../sbin folder
It is not supported by the script by default. But you can add a line to the script and make it work. Assume you want to store output in /tmp/myconfigs
chmod 777 /tmp/myconfigs
Modify the script as below. Find the function 'output_to_file' and the below line
filename = os.path.join('/tmp','myconfigs',filename)
The function should look like below. Make sure indentation is proper. Python has strict checking for indentation
def output_to_file(filename): filename = os.path.join('/tmp','myconfigs',filename) def output(config): with open(filename, 'w') as out_file: json.dump(config, out_file, indent=2) return output
Try commenting the below line in configs.py
I did a basic validation and it works. PUT option alone creates output file by default and GET has a flag -f.
We are basically commenting the PUT operations output file.