def get(self, region, stack_name): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'diagnostics', stack_locking_enabled(), False, False): return False try: mystack.heap_dump() except Exception as e: log.exception('Error occurred taking heap dumps') mystack.log_msg(ERROR, f'Error occurred taking heap dumps: {e}', write_to_changelog=True) mystack.clear_current_action() mystack.clear_current_action() return
def get(self, region, stack_name): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'rollingrebuild', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: mystack.rolling_rebuild() except Exception as e: log.exception('Error occurred doing rolling rebuild') mystack.log_msg(ERROR, f'Error occurred doing rolling rebuild: {e}', write_to_changelog=True) mystack.clear_current_action() mystack.clear_current_action() return
def get(self, region, stack_name): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'runsql', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: outcome = mystack.run_sql() except Exception as e: log.exception('Error occurred running SQL') mystack.log_msg(ERROR, f'Error occurred running SQL: {e}', write_to_changelog=True) mystack.clear_current_action() return False mystack.clear_current_action() return outcome
def post(self, region, stack_name): tags = request.get_json() mystack = Stack(stack_name, region) if not mystack.store_current_action( 'tag', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: outcome = mystack.tag(tags) except Exception as e: log.exception('Error occurred tagging stack') mystack.log_msg(ERROR, f'Error occurred tagging stack: {e}', write_to_changelog=True) mystack.clear_current_action() return False mystack.clear_current_action() return outcome
def get(self, region, stack_name, delete_changelogs, delete_threaddumps): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'destroy', stack_locking_enabled(), not delete_changelogs, session['saml']['subject'] if 'saml' in session else False): return False try: mystack.destroy(delete_changelogs == 'true', delete_threaddumps == 'true') except Exception as e: log.exception('Error occurred destroying stack') mystack.log_msg(ERROR, f'Error occurred destroying stack: {e}', write_to_changelog=True) mystack.clear_current_action() session['stacks'] = sorted(get_cfn_stacks_for_region()) mystack.clear_current_action() return
def get(self, region, stack_name, node, threads, heaps): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'togglenode', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: if threads == 'true': mystack.thread_dump(node=node, alsoHeaps=heaps) if heaps == 'true': mystack.heap_dump(node=node) mystack.toggle_node_registration(node) except Exception as e: log.exception('Error occurred toggling node registration') mystack.log_msg(ERROR, f'Error occurred toggling node registration: {e}', write_to_changelog=True) mystack.clear_current_action() mystack.clear_current_action() return
def get(self, region, stack_name, drain, threads, heaps): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'rollingrestart', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: if threads == 'true': mystack.thread_dump(alsoHeaps=heaps) if heaps == 'true': mystack.heap_dump() mystack.rolling_restart(drain == 'true') except Exception as e: log.exception('Error occurred doing rolling restart') mystack.log_msg(ERROR, f'Error occurred doing rolling restart: {e}', write_to_changelog=True) mystack.clear_current_action() mystack.clear_current_action() return
def post(self, region, stack_name, new_version, zdu): mystack = Stack(stack_name, region) if not mystack.store_current_action( 'upgrade', stack_locking_enabled(), True, session['saml']['subject'] if 'saml' in session else False): return False try: if zdu == 'true': auth = request.get_json()[0] mystack.upgrade_zdu(new_version, auth['username'], auth['password']) else: mystack.upgrade(new_version) except Exception as e: log.exception('Error occurred upgrading stack') mystack.log_msg(ERROR, f'Error occurred upgrading stack: {e}', write_to_changelog=True) mystack.clear_current_action() mystack.clear_current_action() return