# How to debug scripts at Heat's SoftwareConfig resource

Hi,

I found it hard to debug scripts that were declared at SofewareConfig resource. I want to know what is the general practices to debug a user-provided script at SoftwareConfig. At least, I need to check the output of executing the script. Any help will be appreciated. Thanks.

edit retag close merge delete

1

You can also go to the /var/lib/heat-config/heat-config-script and execute your script (it is visible in this directory as file (with ID as name) e.g. 6444.....

( 2014-12-12 01:56:42 -0600 )edit

Sort by » oldest newest most voted

Currently if a deployment resource remains IN_PROGRESS (then times out) the only way to diagnose the issue is to ssh into your server and trigger os-collect-config manually to see what is actually happening. To do this, ssh into your server and run the following:

sudo service os-collect-config stop
sudo os-collect-config --force --one-time --debug


This will do a full metadata poll and then eventually run /usr/libexec/os-refresh-config/configure.d/55-heat-config which will in turn run the specified hook with your deployment data. Generally you should see if there is a problem with your config, or with the networking to signal back to heat.

Throughout the Kilo development cycle there will be many improvements to the debuggability of software deployment resources. Some of these improvements will happen in the hooks or python-heatclient, so they will also be available in Juno and Icehouse heat. I'll update this answer as they become available.

more

Thanks. The command is useful, but it is better to have the outputs logged somewhere in the OS. As a result, we don't need to manually re-run the command, which is impossible in a CI system (i.e. gate).

( 2015-11-27 17:19:06 -0600 )edit

Thanks Steve. I found my problem with the deug command. Also, does the community have plans to save the debug information to a log file?

( 2016-11-01 03:39:09 -0600 )edit

Generally scripts and yaml will be fine. Sometimes VM doesn't resolve the controller(heat-cfn) host name which is metadata url. So, either try to resolve that(using script by appending values to /etc/hosts) or change heat_metadata_server_url in /etc/heat/heat.conf and restart heat-api and heat-engine services. Re-deploy the start again.

To debug Login to VM sudo os-collect-config --force --one-time --debug

Above will generate a dump. look for phase configure. Pasting the logs snippet below. Just FYI

[2016-04-21 22:52:56,011] (os-refresh-config) [INFO] Completed phase pre-configure [2016-04-21 22:52:56,012] (os-refresh-config) [INFO] Starting phase configure dib-run-parts Thu Apr 21 22:52:56 UTC 2016 Running /usr/libexec/os-refresh-config/configure.d/20-os-apply-config [2016/04/21 10:52:56 PM] [INFO] writing /var/run/heat-config/heat-config [2016/04/21 10:52:56 PM] [INFO] writing /etc/os-collect-config.conf [2016/04/21 10:52:56 PM] [INFO] success dib-run-parts Thu Apr 21 22:52:56 UTC 2016 20-os-apply-config completed dib-run-parts Thu Apr 21 22:52:56 UTC 2016 Running /usr/libexec/os-refresh-config/configure.d/55-heat-config [2016-04-21 22:52:56,440] (heat-config) [WARNING] Skipping config 02fbc622-7fb8-482d-8bc1-9f64d7a96c33, already deployed [2016-04-21 22:52:56,440] (heat-config) [WARNING] To force-deploy, rm /var/lib/heat-config/deployed/02fbc622-7fb8-482d-8bc1-9f64d7a96c33.json dib-run-parts Thu Apr 21 22:52:56 UTC 2016 55-heat-config completed

Check content present in /var/run/heat-config/heat-config, If it's empty look the metadata in /etc/os-collect-config.conf

This must exactly point where the issue is

more

Depends on the type of the script. If it is a bash script for instance, you might want to add logs to various operations or just set +x inside the script and dump the output to a file. I guess I might be more helpful if I knew more about what you were trying to do.

more

I try to run tyou cmd, but i don't have this service in my server. What you call server ? The VM target of sofwareconfig or heat server ? For use software deployment , i need a specific VM iso ?

more