carvel-dev / carvel-dev/kapp

request - provide `deleted, changed, noop` values in JSON output

Open
#150 3 comments 0 reactions 0 assignees View on GitHub
helping with an issue
Dominant language
Go
Stars
1.1k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

When I'm calling kapp from ansible I need an easy way to determine if the resources have actually changed.

Currently I call `kapp` with `--json` and then after validating that the return code is `0` I do the following which is not ideal:

```
parsed = json.loads(out)

# attempt to process if changes happened, this involves some ugly text parsing
if kapp_command == "delete":
# check in parse lines to verify it wasn't already deleted
if "App '%s' (namespace: %s) does not exist" % (
module.params['name'], module.params['namespace']
) not in parsed['Lines']:
result['changed'] = True

if kapp_command == "deploy":
# scan output for changes
for line in parsed['Lines']:
if re.match("applying \d+ changes", line):
result['changed'] = True
```

I would love the `json` output to include something like:

```
{"summary": { "changed": 1, "noop": "5", "deleted": "3" } }
```

so I can more easily parse the results.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.