rename debian package to rtslib-fb

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
debian: fix setuptools usage, fix #34

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
debian: update dependencies

We don't have any dependencies anymore.
Additionally, this conflicts with the original rtslib package.

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
debian: use dh_python

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
debian: build python 3 package

This also splits a -docs package for both.

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
Merge pull request #35 from JonnyJD/make_deb

update debian packaging
Update README.md for in-repo packaging policy

See discussion in https://github.com/agrover/configshell-fb/pull/8

Signed-off-by: Andy Grover <agrover@redhat.com>
Add rtslib-saveconfig and rtslib-restoreconfig scripts

Targetcli is not scriptable. One way around this is to modify or create the
json describing the config directly, but even then, targetcli is needed to
save or restore the json file.

These new scripts enable saving or restoring a json-based configuration to
not rely on calling targetcli, or even being installed. These scripts and
just rtslib can properly return exit status & stderr output if
something goes wrong.

Signed-off-by: Andy Grover <agrover@redhat.com>
Consolidate save/restore scripts into a single script

Eliminates some duplicate code and has a better name. Still not using
configparser yet, hopefully we won't need it.

Signed-off-by: Andy Grover <agrover@redhat.com>
Add a 'clear' command to targetctl

It seems like this might be useful. If restore has errors, it will result
in a partially applied configuration. Maybe this what the user wants, or
maybe they'd just as soon have no configuration if any part of it fails.
If so, 'clear' to the rescue if exit status from 'restore' is nonzero.

Signed-off-by: Andy Grover <agrover@redhat.com>
Add manpage for targetctl

Signed-off-by: Andy Grover <agrover@redhat.com>
Add save_to_file and restore_from_file

Push down the ability to save/restore state to/from a file, from targetcli
to rtslib. This will let us coordinate access from multiple API users
(targetd, targetcli, targetctl) to ensure atomicity, and also make
targetcli an optional installed component if the user is not using it.

Modify targetctl to use the new APIs. Since various exceptions set return
status to 1, targetctl should still properly be setting nonzero exit
status so scripts can check it.

Signed-off-by: Andy Grover <agrover@redhat.com>
Add documentation of saveconfig.json format

Signed-off-by: Andy Grover <agrover@redhat.com>
Have rtslib mount configfs if not already mounted

The system service that restores target state may not always be configured
to run. If so, running targetcli may return strange error messages,
because it also is responsible for mounting configfs.

Instead, have rtslib try to mount configfs. If it's already mounted then
no problem, but this will ensure that using targetcli without the target
service activated will work, it just won't have the previous
configuration.

Signed-off-by: Andy Grover <agrover@redhat.com>
In mount_configfs(),  Popen args param should be a sequence

Fixes #37.

Signed-off-by: Andy Grover <agrover@redhat.com>
Better error message if failing to mount configfs

Signed-off-by: Andy Grover <agrover@redhat.com>
Remove unused import

modprobing was moved over to fabric.py.

Signed-off-by: Andy Grover <agrover@redhat.com>
update version to 2.1.41

Signed-off-by: Andy Grover <agrover@redhat.com>
load configfs before mounting it

Signed-off-by: Johannes Dewender <github@JonnyJD.net>
Merge pull request #39 from JonnyJD/modprobe_configfs

load configfs before mounting it