Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 03-27-2018 12:37 PM
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
Created 03-27-2018 01:22 PM
There is no such flag with which the file creation can be disabled. If you want to write to a existing valid file, you can pass the file name using -f option.
.
-Aditya
Created 03-27-2018 01:22 PM
There is no such flag with which the file creation can be disabled. If you want to write to a existing valid file, you can pass the file name using -f option.
.
-Aditya
Created 03-27-2018 01:25 PM
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 ?
Created 03-27-2018 01:26 PM
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
Created 03-27-2018 02:05 PM
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
mkdir /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
Created 03-27-2018 02:19 PM
Try commenting the below line in configs.py
118 #output_to_file(new_file)(new_config)
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.