Exemple #1
0
 def authenticate_username_password(self, args, ignore_cluster):
     """Authenticate using username and password"""
     # Check if user/password have been passed. Else, ask for them.
     username = args.username if args.username else System.getUserInput(
         'Username: '******'Password: ', password=True
         ).rstrip()
     self.rpc = Connection(username=username, password=password,
                           ignore_cluster=ignore_cluster)
     self.session_id = self.rpc.session_id
     self.username = self.rpc.username
Exemple #2
0
 def handle_add(self, p_, args):
     """Handle add of node"""
     cluster_object = p_.rpc.get_connection('cluster')
     if args.connect_string:
         connect_string = args.connect_string
     else:
         connect_string = System.getUserInput('Enter Connect String: ')
     cluster_object.add_node(connect_string)
     p_.print_status('Successfully added node')
Exemple #3
0
    def check_ignore_failed(self, args):
        """Check ignore failed"""
        if args.ignore_failed_nodes:
            # If the user has specified to ignore the cluster,
            # print a warning and confirm the user's answer
            if not args.accept_failed_nodes_warning:
                self.print_status(('WARNING: Running MCVirt with --ignore-failed-nodes'
                                   ' can leave the cluster in an inconsistent state!'))
                continue_answer = System.getUserInput('Would you like to continue? (Y/n): ')

                if continue_answer.strip() is not 'Y':
                    self.print_status('Cancelled...')
                    return
            return True
        return False