In this section, we’ll provide a few handy examples of common script operations. The intention is to grow this into a good source to copy paste common code from. All of the examples are available in the
DevGuide Examples repository under the orchestration_scripts_examples folder.
Executing commands on sandbox resources
The following script attempts to execute a command only on resources that support it. If a resource does not support the command, the script will simply ignore it and move on to the next resource.
App configuration in a sandbox, initiated either by setup orchestration or a dedicated orchestration script, can be performed in parallel or ordered by custom logic using the app_configuration methods.
In the following example, we will configure all the ‘web servers’ Apps after configuring the ‘application server’ App; Also, to enable connection between the deployed Apps,we will pass the application server’s address to the web servers configuration:
Make sure to add a requirements.txt file that will include the cloudshell-orch-core package to use this example.
Note the code in the components helper’s method to get the correct Apps from the sandbox and the usage in the App object rather than the name of the App for other methods like apps_configuration.set_config_param.
Configuration of a sandbox’s Apps can be streamlined by using the OOB setup logic, as described in the CloudShell’s OOB Orchestration section.