charm-ceph-proxy/actions/delete-erasure-profile

36 lines
887 B
Python
Executable File

#!/usr/bin/env python3
from subprocess import CalledProcessError
__author__ = 'chris'
import os
import sys
_path = os.path.dirname(os.path.realpath(__file__))
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
_root = os.path.abspath(os.path.join(_path, '..'))
def _add_path(path):
if path not in sys.path:
sys.path.insert(1, path)
_add_path(_hooks)
_add_path(_root)
from charmhelpers.contrib.storage.linux.ceph import remove_erasure_profile
from charmhelpers.core.hookenv import action_get, config, log, action_fail
def delete_erasure_profile():
name = action_get("name")
try:
remove_erasure_profile(service=config('admin-user'), profile_name=name)
except CalledProcessError as e:
action_fail("Remove erasure profile failed with error: {}".format(
e.message))
if __name__ == '__main__':
delete_erasure_profile()