Repository URL to install this package:
|
Version:
4.0.112 ▾
|
"""Python Module __init__ file."""
from __future__ import print_function
import os
import subprocess
import sys
try:
from configparser import ConfigParser
except:
from ConfigParser import ConfigParser
try:
file_name = '/etc/workloadmgr/vault.conf'
# Get the path
source = os.path.abspath(file_name)
# read the conf file
config = ConfigParser()
config.read(source)
# build a flag containing configuration file info
# and export it as an environment variable
flag = '--config-file=' + source
os.environ['FLAG'] = flag
except Exception as e:
print("You should create vault.conf file", file=sys.stderr)
print("Exception: %s" % str(e), file=sys.stderr)
sys.exit(1)
"""
Build mount points
"""
def mount():
"""Mount s3 fuse mount."""
from . import s3vaultfuse
s3vaultfuse.run()
"""
when the mount function stops running, it actually performs umount.
This is just to clean the remaining folders and files
"""
def umount():
"""umount fuse mount."""
mp = config['DEFAULT']['vault_data_directory']
cahce = config['DEFAULT']['vault_data_directory_old']
subprocess.call(['sudo', 'rm', '-rf', mp])
subprocess.call(['sudo', 'rm', '-rf', cahce])
"""
FIX REQUIRD.
There is a bug that build one additional mount points.
For now, this function will remove the files and folders
from this mountpoint.
"""
def clean():
"""Cleanup directory."""
os.system('find . -empty -type d -delete')