def main(self): instances = self.appresponse.reports.get_instances() if instances: header = [ 'id', 'user_agent', 'owner', 'name', 'completed?', 'is_live?' ] data = [] for i in instances: data.append( (i.data['id'], i.data['user_agent'], i.data['access_rights']['owner'], i.data['info']['name'], i.is_complete(), i.data['live'])) Formatter.print_table(data, header) if not self.options.force: if not prompt_yn('\nDelete all these report instances?', default_yes=False): print('Okay, exiting.') sys.exit(0) for instance in instances: instance.delete() print('Deleted.') else: print('No report instances found.')
def main(self): """Confirm overwrite then update hostgroups.""" confirm = "The contents of hostgroup %s will be overwritten " "by the file %s, are you sure?" % ( self.options.hostgroup, self.options.input_file, ) if not prompt_yn(confirm): print "Okay, aborting." sys.exit() groups = self.import_file() self.update_hostgroups(groups) print "Successfully updated %s on %s" % (self.options.hostgroup, self.netprofiler.host)
def main(self): """Confirm overwrite then update hostgroups.""" confirm = ('The contents of hostgroup {0} will be overwritten ' 'by the file {1}, are you sure?' ''.format(self.options.hostgroup, self.options.input_file)) if not prompt_yn(confirm): print('Okay, aborting.') sys.exit() groups = self.import_file() self.update_hostgroups(groups) print('Successfully updated {0} on {1}'.format(self.options.hostgroup, self.netprofiler.host))
def main(self): """Confirm overwrite then update hostgroups.""" confirm = ('The contents of hostgroup %s will be overwritten ' 'by the file %s, are you sure?' % (self.options.hostgroup, self.options.input_file)) if not prompt_yn(confirm): print 'Okay, aborting.' sys.exit() groups = self.import_file() self.update_hostgroups(groups) print 'Successfully updated %s on %s' % (self.options.hostgroup, self.netprofiler.host)
def main(self): cwd = os.getcwd() if not os.path.exists('manage.py'): console('This command must be run inside the project directory.') return if self.options.interactive: yn = prompt_yn('This will delete and re-initialize the database from ' 'scratch. There is no undo.\nAre you sure?', False) if not yn: console('Aborting.') sys.exit() shell('python manage.py reset_appfwk --force --trace', msg='Resetting project database', cwd=cwd)
def main(self): clips = self.netshark.get_clips(force_refetch=True) if clips: for i, c in enumerate(clips): print '%3d) %s - %s' % (i, c, c.data['config']['description']) if not self.options.force: if not prompt_yn('Delete all these clips?', default_yes=False): print 'Okay, exiting.' sys.exit(0) for c in clips: c.delete() print 'Deleted.' else: print 'No trace clips found on NetShark.'
def main(self): instances = self.appresponse.reports.get_instances() if instances: header = [ 'id', 'user_agent', 'owner', 'name', 'created', 'completed?', 'is_live?' ] data = [] for i in instances: created = self.format_time(i.data['created']) try: # If the instance had an error, an exception will # be raised here, so just catch it complete = i.is_complete() except AppResponseException: complete = 'Error' data.append( (i.data['id'], i.data['user_agent'], i.data['access_rights']['owner'], i.data['info']['name'], created, complete, i.data['live'])) Formatter.print_table(data, header) if not self.options.force: if not prompt_yn('\nDelete all these report instances?', default_yes=False): print('Okay, exiting.') sys.exit(0) for instance in instances: instance.delete() print('Deleted.') else: print('No report instances found.')
print("Initializing and resetting") update.initialize() print("Wait 10 sec ...") sleep(10) print("Resetting into IDLE state") update.reset() else: print("Resetting into IDLE state") update.reset() print("") print("---How to execute an update---") print("In order to execute an update run those steps:") print("1. Initialize update: update.initialize()") print("2. Run update: update.start()") print("Those steps will bring box down and it will be" " inaccessible for some time") else: print("No update retrieved") except RvbdHTTPException as e: if str(e).startswith('404'): raise ValueError('Failed to get an update') if __name__ == '__main__': if prompt_yn( '\nSystem update demonstration might be time consuming.' ' Would you like to continue?', default_yes=False): app = SystemUpdateApp() app.run()