openmicroscopy/openmicroscopy — pull request #2486 by joshmoore (2014-05-13 06:09:41+00:00)
Title: Fs cli plugin (rebased onto develop)

This is the same as gh-2421 but rebased onto develop.

----

In preparation for possibly allowing migrating archived files, unsymlinking files, and similar, the `fs.py` plugin provides some visibility into the contents of the `ManagedRepository` directory. Two commands are currently available:
* `bin/omero fs repos` which simply lists the available repositories, and
* `bin/omero fs sets`.
Basic out put from these are of the form:
```
# | Id | UUID | Type | Path
---+----+--------------------------------------+---------+------------------------------------
0 | 1 | c8db8f5c-b6ba-472f-b0d5-3dac4f31be66 | Public | /home/data//ome2
1 | 2 | ScriptRepo | Script | /opt/ome2/dist/lib//scripts
2 | 3 | c4df3508-cffe-4bf2-a1c8-b3c1395f737f | Managed | /home/data/ome2//ManagedRepository
(3 rows)
```
and
```
bin/omero fs sets --limit=3
# | Id | Prefix | Images | Files | Transfer
---+-----+-------------------------------------+--------+-------+----------
0 | 701 | root_0/2014-05/01/21-26-06.464/ | 1 | 2 |
1 | 651 | 2365b_1756/2014-04/30/20-51-43.057/ | 1 | 1 |
2 | 602 | 2365b_1756/2014-04/30/20-49-24.814/ | 1 | 1 |
(3 rows)
```

The only available option for `repos` is `--managed` to print out just the row with the managed repo. `sets` provides more options:
* `--without-images` - show only filesets which have no images
* `--check` - perform a checksum validation of the files in the fileset
* `--with-transfer` - limit the listing to only particular `--transfer=`.

Tying that all together,
```
$ touch a.fake
$ touch a.fake.ini
$ bin/omero import -- --transfer=ln_s a.fake
$ bin/omero fs sets --check --with-transfer=ln_s
$ bin/omero fs sets --check --with-transfer=ln_s
```
produces
```
# | Id | Prefix | Images | Files | Transfer | Check
---+-----+-------------------------------------+--------+-------+----------+-------
0 | 702 | root_0/2014-05/01/22-02-46.017/ | 1 | 2 | ln_s | OK
```

(Trying to get an example without images is difficult, but I'm working on it.)

Note: this builds on the recent addition of CLI styles in gh-2353