def setUp(self): """ Setup and mount volume or raise ExecutionError """ self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume([self.mounts[0]]) if not ret: raise ExecutionError("Failed to Setup and Mount Volume") # Add a new user to the clients ret = add_user(self.clients[0], "test_user1") if ret is not True: raise ExecutionError("Failed to add user") # Set password for user "test_user1" ret = set_passwd(self.clients[0], "test_user1", "red123") if ret is not True: raise ExecutionError("Failed to set password") # Geneate ssh key on local host cmd = 'echo -e "n" | ssh-keygen -f ~/.ssh/id_rsa -q -N ""' ret, out, _ = g.run_local(cmd) if ret and "already exists" not in out: raise ExecutionError("Failed to generate ssh-key") g.log.info("Successfully generated ssh-key") # Perform ssh-copy-id cmd = ('sshpass -p "red123" ssh-copy-id -o StrictHostKeyChecking=no' ' test_user1@{}'.format(self.clients[0])) ret, _, _ = g.run_local(cmd) if ret: raise ExecutionError("Failed to perform ssh-copy-id") g.log.info("Successfully performed ssh-copy-id")
def _dac_helper(self, host, option): '''Helper for creating, deleting users and groups''' # Permission/Ownership changes required only for `test_metadata..` # tests, using random group and usernames if 'metadata' not in self.test_dir: return if option == 'create': # Groups for group in ('qa_func', 'qa_system'): if not group_add(host, group): raise ExecutionError('Unable to {} group {} on ' '{}'.format(option, group, host)) # User if not add_user(host, 'qa_all', group='qa_func'): raise ExecutionError('Unable to {} user {} under {} on ' '{}'.format(option, 'qa_all', 'qa_func', host)) elif option == 'delete': # Groups for group in ('qa_func', 'qa_system'): if not group_del(host, group): raise ExecutionError('Unable to {} group {} on ' '{}'.format(option, group, host)) # User if not del_user(host, 'qa_all'): raise ExecutionError('Unable to {} user on {}'.format( option, host))
def setUp(self): self.get_super_method(self, 'setUp')() self.first_client = self.mounts[0].client_system self.mountpoint = self.mounts[0].mountpoint self.user_group_created = False # If test case running is test_self_heal_meta_data # create user and group test_name_splitted = self.id().split('.') test_id = test_name_splitted[len(test_name_splitted) - 1] if test_id == 'test_self_heal_meta_data': # Create non-root group if not group_add(self.first_client, 'qa_all'): raise ExecutionError("Failed to create group qa_all") # Create non-root users self.users = ('qa_func', 'qa_system', 'qa_perf') for user in self.users: if not add_user(self.first_client, user, group='qa_all'): raise ExecutionError( "Failed to create user {}".format(user)) self.user_group_created = True g.log.info("Successfully created all users.") # Setup Volume if not self.setup_volume_and_mount_volume([self.mounts[0]]): raise ExecutionError("Failed to setup and mount volume")
def setUp(self): self.get_super_method(self, 'setUp')() # Creating Volume and mounting the volume ret = self.setup_volume_and_mount_volume(mounts=self.mounts) if not ret: raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") self.user = "******" self.client = self.mounts[0].client_system self.mountpoint = self.mounts[0].mountpoint # Add new user on the client node ret = add_user(self.client, self.user) if not ret: raise ExecutionError("Failed to add user")
def setUp(self): # Calling GlusterBaseClass setUp self.get_super_method(self, 'setUp')() self.user = "******" self.nodes = [] self.nodes = copy.deepcopy(self.servers) self.nodes.append(self.clients[0]) # Create user for changing ownership for node in self.nodes: ret = add_user(node, self.user) self.assertTrue(ret, "Failed to create user") # Setup Volume and Mount Volume ret = self.setup_volume_and_mount_volume(mounts=self.mounts) if not ret: raise ExecutionError("Failed to Setup and Mount_Volume")
def setUp(self): self.get_super_method(self, 'setUp')() self.first_client = self.mounts[0].client_system self.mountpoint = self.mounts[0].mountpoint # Create non-root users self.users = ('qa_user', 'qa_admin') for user in self.users: if not add_user(self.first_client, user): raise ExecutionError("Failed to create non-root user {}" .format(user)) g.log.info("Successfully created non-root users") # Setup Volume if not self.setup_volume_and_mount_volume([self.mounts[0]]): raise ExecutionError("Failed to setup and mount volume")
def setUp(self): # Calling GlusterBaseClass setUp self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") ret = self.setup_volume_and_mount_volume(mounts=self.mounts) if not ret: raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") brick_list = get_all_bricks(self.mnode, self.volname) # Add user on all nodes for brick in brick_list: brick_node, _ = brick.split(":") add_user(brick_node, "test_user1") add_user(brick_node, "test_user2") for mount_obj in self.mounts: add_user(mount_obj.client_system, "test_user1") add_user(mount_obj.client_system, "test_user2")
def setUp(self): self.get_super_method(self, 'setUp')() self.all_mounts_procs, self.io_validation_complete = [], False # Create users self.users = ['qa_func', 'qa_system', 'qa_perf', 'qa_all'] for mount_object in self.mounts: for user in self.users: if not add_user(mount_object.client_system, user): raise ExecutionError("Failed to create user " "{}".format(user)) g.log.info("Successfully created all users.") # Setup Volume and Mount Volume ret = self.setup_volume_and_mount_volume(mounts=self.mounts) if not ret: raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume")
def setUp(self): self.get_super_method(self, 'setUp')() # Setup Volume if not self.setup_volume(): raise ExecutionError("Failed to Setup volume") self.first_client = self.mounts[0].client_system self.mount_point = self.mounts[0].mountpoint # Mount volume with -o acl option ret, _, _ = mount_volume(self.volname, self.mount_type, self.mount_point, self.mnode, self.first_client, options='acl') if ret: raise ExecutionError("Failed to mount volume") # Create a non-root user if not add_user(self.first_client, 'joker'): raise ExecutionError("Failed to create user joker")