#!/usr/bin/env python3

import os
import sys

actions = {}
# Use: actions [ ( sysid, 'action' ) ] = 'absolute path to the script'
# Examples :
#actions [ ( 1, 'create' ) ] = '/usr/local/billing/handler/vg_create'
#actions [ ( 1, 'on'     ) ] = '/usr/local/billing/handler/vg_on'
#actions [ ( 1, 'edit'   ) ] = '/usr/local/billing/handler/vg_edit'
#actions [ ( 1, 'off'    ) ] = '/usr/local/billing/handler/vg_off'
#actions [ ( 1, 'delete' ) ] = '/usr/local/billing/handler/vg_delete'

sysid = 0
if len(sys.argv) > 1 and sys.argv[1] == '--sysid':
    sysid = int(sys.argv[2])
action_name = ''
if len(sys.argv) > 3 and sys.argv[3] == '--action':
    action_name = sys.argv[4]
p = (sysid, action_name)

if p in actions:
    os.execv(actions[p], sys.argv)
