def __runmaintenance(self, args): if args == 'db': print('run DB Maintenance') elif args == 'manage_script_upgrade': self.__runmanagementscriptupdate() elif args == 'logs': print('Logs Maintenance') elif args == 'system_upgrades': command_shell.run_shell_command( 'sudo apt-get update -y && sudo apt-get upgrade -y') else: print(CoreUtils.get_help('do maintenance'))
def __runmanagementscriptupdate(): command_shell.run_shell_command( 'git config --global credential.helper \"cache --timeout=3600\"') command_shell.run_shell_command( 'cd \\oms-discussions\\build && sudo git reset --hard HEAD') command_shell.run_shell_command('sudo git clean -f') command_shell.run_shell_command('sudo git pull')
def runcommand(self): if self.__command__ == 'nginx': command_shell.run_shell_command("sudo service nginx restart") elif self.__command__ == 'postgresql': command_shell.run_shell_command("sudo service ") elif self.__command__ == 'api-dev': print('place holder') elif self.__command__ == 'client-dev': print('place holder') elif self.__command__ == 'api-prod': print('place holder') elif self.__command__ == 'client-prod': print('place holder') else: print(CoreUtils.get_help('restart'))
def __installproject(): command_shell.run_shell_command( 'git config --global credential.helper \"cache --timeout=3600\"') command_shell.run_shell_command( 'git clone https://github.gatech.edu/wking6/oms-discussions.git ' + CoreUtils.get_option('main_directory')) command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/ansible') command_shell.run_shell_command( 'ansible-playbook -c local omsdiscussions.yml -i "localhost"')
def build(self): if self.__command == 'api-dev': command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/api') command_shell.run_shell_command('npm install') elif self.__command == 'client-dev': command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/client && sudo npm install && sudo ng build') elif self.__command == 'api-prod': command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/api && sudo npm install') elif self.__command == 'client-prod': command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/client && sudo npm install && sudo ng build --dist --prod --build-optimizer' ) else: print(CoreUtils.get_help('show'))
def __audit_client(): command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/oms-discussions && sudo npm audit')
def __audit_api(): command_shell.run_shell_command( 'cd ' + CoreUtils.get_option('main_directory') + '/api && sudo npm audit')
def __installpreqs(): command_shell.run_shell_command( 'sudo apt-add-repository ppa:ansible/ansible-2.6 && sudo apt-get update && sudo apt-get install -y ansible git' )