hamlet-io / executor-bash

Executor for hamlet based on bash
GNU General Public License v3.0
0 stars 4 forks source link

[BUG] Generation contract always being reported as change #185

Closed ml019 closed 3 years ago

ml019 commented 3 years ago

Current Behaviour

Whenever a template generation is run, the generation contract is always reported as different even though it may not be.

Expected Behaviour

Only real changes in the generation contract should be reported as differences.

Possible Solution

The problem is in the logic that detects change by comparing the generated file to the current file in the CMDB. The first check performed is whether there is any generation contract currently present. If not, then a difference is forced.

However, with the moving of file naming into the engine, the actual generation contract filename in the CMDB is not known when the generation contract pass is run, so a fixed filename is used, and the generation contract has a step to rename it. This means at the time the generation contract is checked for differences, it uses the fixed name to check for an existing file and fails.

A possible solution would be to add difference detection /processing as a step in the generation contract rather than be implicit behaviour of createTemplate. Then the first step of the contract would be to check itself for differences using the correct filenames.

Steps to Reproduce

  1. Run a create template on an unchanged unit
  2. Observe the log of what has changed

Your Environment