Debugging extension_start
Introduction
On this page, we will cover the following:
- Debugging
extension_start
Step 1 - Debugging extension_start
So far, we have launched/debugged two different dynamic choice commands. Now, to put it all together, we will add two configurations for extension_start
: one that will delete a file and another for appending contents to a file.
Add an entry to delete a file. You may need to change which file and what directory to delete in:
Notice that extension_start
accepts an array of configurations similar to how dynamic choice commands were configured above. extension_start
has some additional unique properties, one of them being runtime_directory
. From the Controller, it is possible to set the runtime directory before launching the Extension (once again, not possible for dynamic choice commands). So, the runtime_directory
property is added to mimic that behavior. For extension_start
, we don’t need to use the target_directory
field, though we could if we wanted to (with some extra steps of changing to that directory manually).
Launch delete_file_msi
(or whatever you named it). Inspect the directory specified in runtime_directory
and the specified file
should have been removed.
Now, we will add another configuration entry to extension_start
to show how configurations.yml
detects dependent fields and issues errors. Go ahead and add an entry similar to the one shown below:
configurations.yml
should be reporting an error now. If you hover over the fields
property under append_to_file_txt
, it should say Missing property "contents"
. The contents
field was set to be required if the value of action
is Append
(you can verify this by opening the template in the Controller and checking the contents
field). The .schema
file has logic to enforce this behavior as well, which is why configurations.yml
is complaining. Go ahead and add the contents
field along with some sample contents:
- name: append_to_file_txt log_level: Inherited runtime_dir: fields: action: - Append contents: | this is line 1 this is line 2 this is line 3 file: - file.txt backup: true
Now, launch append_to_file_txt
(or whatever you named it). Inspect the directory specified in runtime_directory
and the specified file
should have been appended with contents
and a backup should have been made with .bkp
extension.