Sleds/buildvm/scat/scat_initmongo.py

37 lines
795 B
Python

#!/bin/python3
'''
Created on Apr 5, 2016
author: tpweis
file name: scat_initmongo.py
This functions sends initiates a recipe to run a bot
This function also represent a segment of the SCAT. The SCAT contains
any required IP or URN identifiers.
'''
import os
import subprocess
import sys
sys.path.insert(0,'/sl/lib')
from sleds_utilities import *
def main():
"function main"
argv = sys.argv[1:]
IPADDR, USER, URN, MONGO = slscatargs(argv)
slscatlog('I',"scat_initmongo: " + IPADDR + ", " + USER + ", " + URN)
CMD="mongo_initlocdb"
FULL_CMD = "echo " + CMD + " | nc -n " + IPADDR + " 52525"
slscatlog('D',"run: " + FULL_CMD)
subprocess.call([FULL_CMD], shell=True)
exit()
if __name__ == '__main__':
# execute only if run as a script
main()