This article is going to tackle how to copy all of the parameters and all of their options from one environment to another via shell_plus.
SSH into your Cloudbolt server with this command: 'ssh root@<cloudbolt_ip>'
Make sure to replace <cloudbolt_ip> with the correct ip/dns of your Cloudbolt server
Run this command to enter shell_plus: ‘/opt/cloudbolt/manage.py shell_plus’
Make sure you grab the ID of both, the environment you want to copy to, and the one you’re copying from. You can find these by navigating to the environments detail page and looking at the number at the end of the URL.
After you have the ID’s of both environments, you can enter these commands in order:
main_env = Environment.objects.get(id=12) main_env_cfvs = main_env.custom_fields.all() main_env_options = main_env.custom_field_options.all() second_env = Environment.objects.get(id=13) second_env.custom_fields.set(main_env_cfvs) second_env.custom_field_options.set(main_env_options) second_env.save()
5. If you would like to copy the parameters to multiple different environments the code would chance slightly to look like this:
#IDs of all the secondary environments empty_envs = [1, 2, 3, 4, 5, 6, 7] main_env = Environment.objects.get(id=12) main_env_cfs = main_env.custom_fields.all() main_env_options = main_env.custom_field_options.all() for env in empty_envs: env.custom_fields.set(main_env_cfs) env.custom_field_options.set(main_env_options) env.save()