-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.py
executable file
·30 lines (25 loc) · 927 Bytes
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Hack to be able to import local modules
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
# Import leverage libraries
from leverage import task
from leverage import path
# custom functions
from build_deplayerchk import *
@task()
def _checkdir():
'''Check if current directory can execute certain tasks'''
if path.get_working_path() == path.get_root_path():
print("This task cannot be run from root path")
sys.exit(0)
elif path.get_working_path() == path.get_account_path():
print("This task cannot be run from account path")
sys.exit(0)
@task(_checkdir)
def decrypt():
'''Decrypt secrets.tf file.'''
os.system("ansible-vault decrypt --output secrets.dec.tf secrets.enc")
@task(_checkdir)
def encrypt():
'''Encrypt secrets.dec.tf file.'''
os.system("ansible-vault encrypt --output secrets.enc secrets.dec.tf && rm -rf secrets.dec.tf")