~openstack-charmers-next/charms/precise/ceph-mon/trunk

« back to all changes in this revision

Viewing changes to actions/snapshot-pool.py

  • Committer: Chris Holcombe
  • Date: 2016-06-29 23:01:40 UTC
  • Revision ID: xfactor973@gmail.com-20160629230140-5zracms49l25x8id
Symlink Actions

This change symlinks the python actions files so that tox
can properly test the code.

Change-Id: Ib6d070555535dc202735124afdafa8dd401350df

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import sys
 
3
 
 
4
sys.path.append('hooks')
 
5
from subprocess import CalledProcessError
 
6
from charmhelpers.core.hookenv import action_get, log, action_fail
 
7
from charmhelpers.contrib.storage.linux.ceph import snapshot_pool
 
8
 
 
9
if __name__ == '__main__':
 
10
    name = action_get("pool-name")
 
11
    snapname = action_get("snapshot-name")
 
12
    try:
 
13
        snapshot_pool(service='admin',
 
14
                      pool_name=name,
 
15
                      snapshot_name=snapname)
 
16
    except CalledProcessError as e:
 
17
        log(e)
 
18
        action_fail("Snapshot pool failed with message: {}".format(e.message))