Sam Arnold 9ddf110ad6
fix: template apply uses better diff checking (#358)
* fix: template apply uses better diff checking

Previously, we did a DeepEqual of all the returned data about each changed entity,
but due to our template overrides that is not actually all the information
available for each entity. So we marked trivial things as 'conflicts' (e.g.
telegraf config ID's 'changing' from the empty string to the real, current value)
while not catching important conflicts like flux script changes in checks and tasks.

Changes to make things more straightforward:

 * Change the --force behaviour to be more similar to `apt install`, where even
in non-interactive mode `--force yes` is required to bypass the prompt to apply.

  * Before, there were two stages of diff checking - once to print diffs, and once
after the 'Yes/No' prompt. If any conflicts were detected in the second check,
the user got an inscrutable error message that did not highlight what the difference
was or how to force it to apply. `--force conflict` was required to avoid this error.
Instead, we now have simplified to `--force yes` to bypass the 'Yes/No' prompt, and
we never do a second stage of diff checking.

 * Because we do not currently properly account for more complicated diffs (e.g.
flux tasks), we now assume in the diff printing that every object has changes,
except for Labels, Buckets, Variables, and Label Mappings. This could be improved
in the future.

* fix: when statestatus is 'remove', mark as removed
2022-02-04 10:59:02 -05:00
2021-10-18 13:22:54 -05:00
2021-10-18 13:22:54 -05:00
2021-04-09 14:21:16 -04:00

influx-cli

CLI for managing resources in InfluxDB v2

Motivation

This repository decouples the influx CLI from the OSS influxdb codebase. Our goals are to:

  1. Make it easier to keep the CLI up-to-date with InfluxDB Cloud API changes
  2. Enable faster turn-around on fixes/features that only affect the CLI
  3. Allow the CLI to be built & released for a wider range of platforms than the server can support

Building the CLI

Follow these steps to build the CLI. If you're updating your CLI build, see Updating openapi below.

  1. Clone this repo (influx-cli) and change to your influx-cli directory.

    git clone git@github.com:influxdata/influx-cli.git
    cd influx-cli
    
  2. Build the CLI. The make and make influx commands write the new binary to bin/$(GOOS)/influx.

    make
    

Updating openapi

If you change or update your branch, you may also need to update influx-cli/openapi and regenerate the client code. influx-cli/openapi is a Git submodule that contains the underlying API contracts and client used by the CLI. We use OpenAPITools/openapi-generator to generate the HTTP client.

To update, run the following commands in your influx-cli repo:

  1. Update the openapi Git submodule. The following command pulls the latest commits for the branch and all submodules.

    git pull --recurse-submodules

  2. With Docker running locally, regenerate openapi.

    make openapi

  3. Rebuild the CLI

    make

Running the CLI

After building, use influx -h to see the list of available commands.

Enabling Completions

The CLI supports generating completions for bash, zsh, and powershell. To enable completions for a single shell session, run one of these commands:

# For bash:
source <(influx completion bash)
# For zsh:
source <(influx completion zsh)
# For pwsh:
Invoke-Expression ((influx completion powershell) -join "`n`")

To enable completions across sessions, add the appropriate line to your shell's login profile (i.e. ~/.bash_profile).

Testing

Run make test to run unit tests.

Description
No description provided
Readme 1.8 MiB
Languages
Go 92%
Mustache 6.1%
Shell 1.6%
Makefile 0.3%