Skip to content

Commit

Permalink
dev: add git committer for ndmtk (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
greenpau authored Feb 21, 2017
1 parent 49110fc commit f9e14bc
Show file tree
Hide file tree
Showing 11 changed files with 493 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export USER
PLUGIN_NAME="ndmtk"
PLUGIN_NAME_EGG := $(subst -,_,$(PLUGIN_NAME))
PLUGIN_VER=0.1.5
PLUGIN_VER=0.1.6
DOCKER_IMAGE_NAME="greenpau/ndmtk"
DOCKER_CONTAINER_NAME="ndmtk"
DOCKER_CONTAINER_SHELL="/bin/sh"
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ machine:
version: 2.7.5
environment:
PACKAGE: ndmtk
VERSION: '0.1.5'
VERSION: '0.1.6'
TAG1: ${VERSION}-$(date +%Y%m%dT%H%M)-git-${CIRCLE_SHA1:0:7}
TAG2: ${CIRCLE_PR_USERNAME}_${CIRCLE_BRANCH/pull\//pr_}
services:
Expand Down
4 changes: 2 additions & 2 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY demo/firewall/files/ndmtk/spec/*.yml /etc/ansible/files/ndmtk/spec/
COPY demo/firewall/files/ndmtk/os/*.yml /etc/ansible/files/ndmtk/os/
COPY demo/firewall/files/ndmtk/host/*.yml /etc/ansible/files/ndmtk/host/
COPY demo/firewall/files/ndmtk/exceptions.yml /etc/ansible/files/ndmtk/
COPY dist/ndmtk-0.1.5.tar.gz /usr/local/src/
RUN pip install /usr/local/src/ndmtk-0.1.5.tar.gz
COPY dist/ndmtk-0.1.6.tar.gz /usr/local/src/
RUN pip install /usr/local/src/ndmtk-0.1.6.tar.gz

ENTRYPOINT ["/bin/sh"]
4 changes: 2 additions & 2 deletions docker/centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY demo/firewall/files/ndmtk/spec/*.yml /etc/ansible/files/ndmtk/spec/
COPY demo/firewall/files/ndmtk/os/*.yml /etc/ansible/files/ndmtk/os/
COPY demo/firewall/files/ndmtk/host/*.yml /etc/ansible/files/ndmtk/host/
COPY demo/firewall/files/ndmtk/exceptions.yml /etc/ansible/files/ndmtk/
COPY dist/ndmtk-0.1.5.tar.gz /usr/local/src/
RUN pip install /usr/local/src/ndmtk-0.1.5.tar.gz
COPY dist/ndmtk-0.1.6.tar.gz /usr/local/src/
RUN pip install /usr/local/src/ndmtk-0.1.6.tar.gz

ENTRYPOINT ["/bin/bash"]
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.1.5'
version = u'0.1.6'
# The full version, including alpha/beta/rc tags.
release = u'0.1.5'
release = u'0.1.6'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
47 changes: 47 additions & 0 deletions ndmtk-git/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Git for Network Discovery and Management Toolkit

This tool is a part of [Network Discovery and Management Toolkit](https://github.com/greenpau/ndmtk).
It allows checking the data collected from network devices in to a Git repository.

The key points relates to the use of the tool:
- The collected data comes in a form of file. The tool commits a file at a time.
- The commit subject is formatted as `<device> [<status>] <cli_commnand>`, e.g.
`ny-fw01 [ok] show running-config`.
- The commit body contains all the metadata associated with a particular
cli command.

The tool requires [GitPython](http://gitpython.readthedocs.io).

```
pip install gitpython --user
```

## Getting Started

First, create and initialize a repository:

```
mkdir -p /opt/ndmtk-data && cd /opt/ndmtk-data && git init
```

Next, run `ndmtk` data collection with the output directory pointing
to `/tmp/runner-data`.

```yaml
---
- name: data collection for git
hosts:
- all
gather_facts: no
tasks:
- name: data collection
action: ndmtk output="/tmp/runner-data" debug=no no_host_key_check=yes on_error=continue
```
Then, run this tool to commit the data in `/tmp/runner-data` to `/opt/ndmtk-data`
Git repository.

```
ndmtk-git -r /opt/ndmtk-data -b master -d /tmp/runner-data -l 1 --commit
```
Loading

0 comments on commit f9e14bc

Please sign in to comment.