示例#1
0
def release_hosts(host_filter_data, username=None):
    """
    :param host_filter_data: Filters out which hosts to reserve.
    :param username: login of the user reserving hosts
    :type username: str
    """
    hosts = models.Host.query_objects(host_filter_data)
    reservations.release(hosts_to_release=[h.hostname for h in hosts], username=username)
示例#2
0
def release_hosts(host_filter_data, username=None):
    """
    :param host_filter_data: Filters out which hosts to reserve.
    :param username: login of the user reserving hosts
    :type username: str
    """
    hosts = models.Host.query_objects(host_filter_data)
    reservations.release(hosts_to_release=[h.hostname for h in hosts],
                        username=username)
示例#3
0
    def test_nop_release(self):
        '''
        Tests releasing hosts from a user that doesn't have a host reserved

        This should perform no action, and the user should continue to have
        no access to the host
        '''
        reservations.release(['reshost4'], self.user1.login)
        self.assertRaises(models.AclAccessViolation, reservations.create,
                          ['reshost4'], self.user1.login)
示例#4
0
    def test_nop_release(self):
        '''
        Tests releasing hosts from a user that doesn't have a host reserved

        This should perform no action, and the user should continue to have
        no access to the host
        '''
        reservations.release(['reshost4'], self.user1.login)
        self.assertRaises(models.AclAccessViolation,
                          reservations.create,
                          ['reshost4'],
                          self.user1.login)
示例#5
0
    def test_normal_reserve_lifecycle(self):
        '''
        Tests the normal reservation lifecycle

        A few hosts will be reserved for a given user, and then a second
        user tries to access the host.
        '''
        # reserve few hosts
        host_names = [h.hostname for h in self.reservation_hosts[0:2]]
        reservations.create(host_names, self.user1.login)

        # second user cannot access it
        self.assertRaises(models.AclAccessViolation,
                          models.AclGroup.check_for_acl_violation_hosts,
                          self.reservation_hosts[0:2], self.user2.login)

        reservations.release(host_names, self.user1.login)
        models.AclGroup.check_for_acl_violation_hosts(
            self.reservation_hosts[0:2], self.user2.login)
示例#6
0
    def test_normal_reserve_lifecycle(self):
        '''
        Tests the normal reservation lifecycle

        A few hosts will be reserved for a given user, and then a second
        user tries to access the host.
        '''
        #reserve few hosts
        host_names = [h.hostname for h in self.reservation_hosts[0:2]]
        reservations.create(host_names, self.user1.login)

        #second user cannot access it
        self.assertRaises(models.AclAccessViolation,
                          models.AclGroup.check_for_acl_violation_hosts,
                          self.reservation_hosts[0:2],
                          self.user2.login)

        reservations.release(host_names, self.user1.login)
        models.AclGroup.check_for_acl_violation_hosts(
            self.reservation_hosts[0:2], self.user2.login)