Help with charmhelpers

Hi,

I’d like to add a functionality to an existing charm to mount an NFS share from an external source (outside of Juju).

I see that charmhelpers has a fstab module (https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/fstab.py). I’m thinking of using that to mount my NFS share but I’m having trouble finding the documentation for the right way to use these charmhelpers.

https://github.com/juju/charm-helpers says that “The full documentation is available online at: https://charm-helpers.readthedocs.io/” but on that docs page I see the following:

Creating a New Charm

$ cd ~
$ mkdirs -p charms/precise
$ cd charms/precise
$ charm create -t python mycharm
INFO: Generating template for mycharm in ./mycharm
INFO: No mycharm in apt cache; creating an empty charm instead.
Symlink all hooks to one python source file? [yN] y
INFO:root:Loading charm helper config from charm-helpers.yaml.
INFO:root:Checking out lp:charm-helpers to /tmp/tmpPAqUyN/charm-helpers.
Branched 160 revisions.
INFO:root:Syncing directory: /tmp/tmpPAqUyN/charm-helpers/charmhelpers/core -> lib/charmhelpers/core.
INFO:root:Adding missing __init__.py: lib/charmhelpers/__init__.py

Let’s see what our new charm looks like:

$ tree mycharm/
mycharm/
├── charm-helpers.yaml
├── config.yaml
├── hooks
│   ├── config-changed -> hooks.py
│   ├── hooks.py
│   ├── install -> hooks.py
│   ├── start -> hooks.py
│   ├── stop -> hooks.py
│   └── upgrade-charm -> hooks.py
├── icon.svg
├── lib
│   └── charmhelpers
│       ├── core
│       │   ├── fstab.py
│       │   ├── hookenv.py
│       │   ├── host.py
│       │   └── __init__.py
│       └── __init__.py
├── metadata.yaml
├── README.ex
├── revision
├── scripts
│   └── charm_helpers_sync.py
└── tests
    ├── 00-setup
    └── 10-deploy

6 directories, 20 files

When I do charm create -t python mycharm, all I get is:

INFO: Generating charm for mycharm in ./mycharm
INFO: No mycharm in apt cache; creating an empty charm instead.

And when I do tree, I get:

.
├── config.yaml
├── hooks
│ ├── actions.py
│ ├── config-changed
│ ├── install
│ ├── services.py
│ ├── setup.py
│ ├── start
│ ├── stop
│ └── upgrade-charm
├── icon.svg
├── metadata.yaml
├── README.example
├── templates
│ └── upstart.conf
├── tests
│ ├── 00-setup
│ └── 10-deploy
└── unit_tests
└── test_actions.py

4 directories, 16 files

What’s the right starting point for getting started with charmhelpers and use the fstab module?

Thanks!

1 Like

I’m interested in this topic too. Maybe @hallback have some input aswell? I know he has been looking into storage related things in juju charming.

Don’t use this in production but I’ve made one for my homelab that may be of interest: https://jujucharms.com/u/chris.macnaughton/remote-nfs/

It allows mounting of an NFS share to a specified location, and is a subordinate