DSC get, test, and set
Observe, compare, then converge.
The idea
Get retrieves current resource state. Test compares it with desired state and reports whether it matches. Set enforces the desired state. These are different operations: a successful get does not show compliance, and set can change the machine. Inspect the command output and process exit status according to the installed CLI version.
Follow the flow
Make it concrete
This excerpt isolates the concept. Connect it to the booking API as you work through the exercise.
dsc config get --file lab.dsc.yaml
dsc config test --file lab.dsc.yaml
dsc config set --file lab.dsc.yaml
dsc config test --file lab.dsc.yamlDecisions that matter
- Get is observation; test is comparison; set may mutate resources.
- Inspect per-resource results in addition to command completion.
- Run practice configurations only in the intended disposable environment.
Your turn
After set succeeds, why run test again?
Reveal a worked answer
Verify the resulting state rather than assuming execution success equals convergence. Save the before and after evidence, investigate resources that still differ, and confirm any dependent service is actually healthy.