cPanel & WHM Version 108 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

--dry-run flag for whmapi1 calls and hooks

Blue Presley shared this idea 2 years ago
Open Discussion

When the Shell API is enabled in WHM we developers get the warning:

WARNING: This feature operates on the live system.

Am I missing something? Are there no options for --dry-run to see what would happen without affecting the system?

Developing for cPanel I feel like a surgeon trying to do open heart surgery while on a roller coaster.

Testing scripts on a production server with 100s of users is indeed quite the rush each time you hit "Enter." I know that I can get a developer's license and test these on there, but sometimes that is not enough.

It has happened a few times that by the time I'm finished on my development server, I have issues on my production server because that environment has changed so much (maybe a package has changed, feature no longer available, etc).

It's also been the case that when I finish developing, the underlying production server environment is different enough to cause problems. Here is an actual example in the wild with code written by a cPanel staff member:

DOMAIN=$(python -c "import sys, json; print json.load(open('$TMPFILE'))['data']['domain']")

CUSTOMEREMAIL=$(python -c "import sys, json; print json.load(open('$TMPFILE'))['data']['contactemail']")

That above code worked fine in his environment and on my older dev server as well. It drove me insane for the 5 min this wasn't working in the live environment, until I figured out I needed to use python3 instead of python.

With cPanel, I'm finding that too great a difference can exist between a development environment and a production. We need to be able to run our code on the production server, but we also need the assurance that we can do so safely, and that is where --dry-run comes in.

This will allow us to fix the nuances that are going to allow it to run successfully in its production environment.

Leave a Comment
Attach a file