Smart Automated Maintenance Series: The Final Countdown
August 22, 2024
Welcome back. Oh, look, turkeys are in season at the store. This can only mean one thing … it’s November and the start of Change Freeze season. It also means that it’s time to finish all those annoying maintenance tasks that have piled up all year, like the leaves in your yard (you know who you are).
On-Demand Script Execution: How to Run Your Maintenance Scripts Anytime
The automation we’ve set up over the past year has been working well, but wouldn’t it be nice to run the script on demand? Currently, the application test only runs successfully on the last day of the month.
Step-by-Step Guide: Adapting Your Script for On-Demand Execution
This comes with its own requirements and challenges. Here’s what we need to do:
- Determine our test type.
- Determine what actions we need to take.
- Ensure the continuous test functions as expected with minimal changes.
Simplifying Your Workflow: Moving Code into Functions
Let’s tackle the easiest steps first.
For item 3, we can move the existing code into a new function after the date check. Let’s call it License Generation. Add a couple of lines to create the function and call it—done.
Customizing Maintenance Actions Based on Test Type
Cool, now on to item 2. We need to:
- Check the test type.
- If it’s a continuous test and the last day, execute. Otherwise, close with success.
- If it’s an application test, execute the license replacement regardless of the day.
- Check the date.
- Report to the appliance what our test type is and what actions we’re taking.
Determining Your Test Type: A Technical Deep Dive
Let’s investigate the most complicated part: determining our test type. Unfortunately, this information hasn’t been natively passed to the engine from the appliance. Drats. It’s time to dig deeper. In the log, we know which appliance we’re talking to and can find our test run ID. Nifty. I bet there’s an API query we can use to check the test information on the appliance. We can get the current test type by using the tests API endpoint and supplying the environment ID (test ID).
Final Steps: Completing Your Automation for 2041
Finally, we just need to add the remaining logic: if the test is running as an application test, perform the maintenance actions as normal since they are now a requested action. And now we’re done. Onwards to 2041, the year of automation.
Thanks for Reading our Smart Automated Maintenance Series
Have you enjoyed this series? Sign up for our newsletter today to get tips and tricks sent directly to you!
EUC Trends