An entry for the c4l13 Fedora Hackfest by Stephen Eisenhauer
FedoraFS is a filesystem driver built using FUSE which allows a user to
mount a Fedora repository to a directory on their local machine.
Essentially, this allows the user to browse and interact with the contents
of the repository using
mkdir, et. al, in a familiar
and painless way.
The interactions are accomplished by the driver via use of the Fedora REST API (aka Legacy API).
FedoraFS has been developed over the last two days, and sports the following exciting features:
- NO error handling!
- NO readable or maintainable code!
- NO elegant execution flow!
- LOW efficiency! and
- LOW stability!
Despite these confidence-inspiring attributes, I still wouldn't recommend pointing this at any Fedora instance that isn't disposable, and I especially don't recommend trying to incorporate this into any kind of actual workflow or automated scripting tasks (at least in its current state).
FedoraFS has only been tested on Ubuntu (12.04+). You'll need Python and python-fuse.
sudo apt-get install libfuse-dev python-pip sudo pip install python-fuse
You'll want to download the script somewhere, and create an empty directory to use as a mount point. Somewhere within your home directory works great. No sudo necessary.
$ wget https://gist.github.com/BHSPitMonkey/36aa5674a24b19393387/raw/FedoraFS.py $ mkdir mnt
Now to mount the repository:
$ python FedoraFS.py mnt
No output means no problems. Let's take a look around:
$ tree mnt # sudo apt-get install tree, if you don't have it mnt ├── describe │ └── repositoryVersion └── objects └── all 3 directories, 1 file
Not much here yet, since this is an empty repository. We can see the repository version like so:
$ cat mnt/describe/repositoryVersion 4.0-modeshape-candidate
Wonderful. I think it's about time we added an object to our repository, though:
$ mkdir mnt/objects/all/AllYourBase $ ls mnt/objects/all/AllYourBase/ datastreams profile.xml
How about that. Let's look at the new object's profile, in all its XML-ey glory:
$ cat mnt/objects/all/AllYourBase/profile.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fedora-access:objectProfile xmlns:fedora-access="http://www.fedora.info/definitions/1/0/access/" xmlns:fedora-management="http://www.fedora.info/definitions/1/0/management/" pid="AllYourBase"> <objLabel>AllYourBase</objLabel> <objOwnerId><anonymous></objOwnerId> <objSize>374</objSize> <objModels> <model>fedora:object</model> <model>fedora:owned</model> </objModels> <objCreateDate>2013-02-14T00:20:15.658-06:00</objCreateDate> <objLastModDate>2013-02-14T00:20:15.657-06:00</objLastModDate> <objItemIndexViewURL>http://localhost:8080/rest/objects/AllYourBase/datastreams</objItemIndexViewURL> <objState>A</objState> </fedora-access:objectProfile>
My head's starting to hurt, so we're definitely getting somewhere. Objects are pretty lame if they don't have any datastreams, I think, so let's create one for our new object:
$ mkdir mnt/objects/all/AllYourBase/datastreams/text $ ls mnt/objects/all/AllYourBase/datastreams/text/ content profile.xml
Now we're in business. Let's take another high-level look at things now:
$ tree mnt mnt ├── describe │ └── repositoryVersion └── objects └── all └── AllYourBase ├── datastreams │ └── text │ ├── content │ └── profile.xml └── profile.xml 6 directories, 4 files
Spiffy! Let's put some words into our new datastream called 'text':
$ echo "All your base are belong to us." > mnt/objects/all/AllYourBase/datastreams/text/content bash: mnt/objects/all/AllYourBase/datastreams/text/content: Function not implemented
... What, did you really expect me to implement ALL the functionality in my spare time around the conference?