Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kennethkalmer/fleet-diff
Easily check if there is a difference between a local unit file and the one loaded in fleet
https://github.com/kennethkalmer/fleet-diff
Last synced: about 15 hours ago
JSON representation
Easily check if there is a difference between a local unit file and the one loaded in fleet
- Host: GitHub
- URL: https://github.com/kennethkalmer/fleet-diff
- Owner: kennethkalmer
- Created: 2016-02-14T19:37:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-14T19:40:49.000Z (almost 9 years ago)
- Last Synced: 2024-04-16T05:35:25.648Z (7 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fleet-diff
Helps you diff systemd unit files as serialized by [fleet](https://github.com/coreos/fleet).
## Background
Lets assume you've got a directory full of unit files, and you're uncertain
which files in your remote fleet differ from the ones in your local repository.You could try and diff the output of `fleetctl cat`, but if your unit file has
any newlines in you'll get a false negative.For example, lets say our unit has something like this:
```
ExecStart=/bin/bash -c ' \
echo $(etcdctl get /hello)
'
```This would look more or less like the following when using `fleetctl cat`
```
$ fleetctl cat hello.service
ExecStart=/bin/bash -c ' echo $(etcdctl get /hello) '
```Doing a simple diff no longer works.
## Usage
`fleet-diff` takes the output from `fleetctl cat` and the path to a local unit
and then parses both using the [unit package](https://github.com/coreos/fleet/blob/master/unit/unit.go) and then compares the units.```
$ fleetctl cat hello.service | fleet-diff hello.service -
Everything looks fine.
$ echo $?
0
````fleet-diff` accepts two arguments, paths to unit files. If one of the paths is a `-` character, `fleet-diff` will read STDIN for the content.
`fleet-diff` will have an exit code of `0` if the units match, or `1` if they don't, making it easier to use in scripting.
### Diffing two files
```
$ fleetctl cat hello.service > hello-submitted.service
$ fleet-diff hello.service hello-submitted.service
Units are different!
$ echo $?
1
```## Installation
You need [go](https://golang.org/) installed to build the binary, then simply run:
```
$ go install https://bitbucket.org/mylightstone/fleet-diff
```Go will place the final binary in your `$GOPATH/bin` directory, so make sure it is available in your `$PATH`.
## License