Bug 1370521

Summary: operator_role in tempest.conf is SwiftOperator instead of swiftoperator making the s3 tests to fail
Product: Red Hat OpenStack Reporter: Ramon Acedo <racedoro>
Component: rhosp-directorAssignee: Angus Thomas <athomas>
Status: CLOSED NOTABUG QA Contact: Martin Kopec <mkopec>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0 (Mitaka)CC: apevec, dbecker, dmellado, lhh, mapiccin, mburns, mmagr, morazi, racedoro, rhel-osp-director-maint, slinaber
Target Milestone: ---   
Target Release: 11.0 (Ocata)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-16 12:22:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ramon Acedo 2016-08-26 14:33:14 UTC
In OSP 9, after running /usr/share/openstack-tempest-10.0.0/tools/configure-tempest-directory in the ~stack/tempest directory, the operator_role is SwiftOperator:

[stack@undercloud-1 tempest]$ grep operator etc/tempest.conf
operator_role = SwiftOperator

In OSP 8 the same file is swiftoperator after running the configure-tempest-directory script for liberty:

[stack@undercloud-3 tempest]$ grep operator etc/tempest.conf
operator_role = swiftoperator

This causes the s3 tests to fail, e.g:

setUpClass (tempest.api.object_storage.test_object_services.ObjectTest)
-----------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/home/stack/tempest/tempest/test.py", line 280, in setUpClass
        six.reraise(etype, value, trace)
      File "/home/stack/tempest/tempest/test.py", line 268, in setUpClass
        cls.setup_credentials()
      File "/home/stack/tempest/tempest/api/object_storage/base.py", line 38, in setup_credentials
        super(BaseObjectTest, cls).setup_credentials()
      File "/home/stack/tempest/tempest/test.py", line 379, in setup_credentials
        force_new=True)
      File "/home/stack/tempest/tempest/test.py", line 535, in get_client_manager
        creds = cred_provider.get_creds_by_roles(**params)
      File "/home/stack/tempest/tempest/common/dynamic_creds.py", line 297, in get_creds_by_roles
        return self.get_credentials(roles)
      File "/home/stack/tempest/tempest/common/dynamic_creds.py", line 260, in get_credentials
        credentials = self._create_creds(roles=credential_type)
      File "/home/stack/tempest/tempest/common/dynamic_creds.py", line 145, in _create_creds
        self.creds_client.assign_user_role(user, project, role)
      File "/home/stack/tempest/tempest/common/cred_client.py", line 72, in assign_user_role
        raise lib_exc.NotFound(msg)
    tempest.lib.exceptions.NotFound: Object not found
    Details: No "SwiftOperator" role found

As a workaround, deleting the role swiftoperator and adding SwiftOperator makes it work and I haven't tested it but I'd imagine setting operator_role = swiftoperator in tempest.conf as it previously was in OSP 8 would also work.

Comment 4 Martin Kopec 2016-11-16 12:22:17 UTC
OSP uses lowercase operator for the role, so:

operator_role = swiftoperator

However, tempest default value is "SwiftOperator", which is the default value. Therefor when tempest.conf is created through config_tempest.py it's needed to add an argument to override the default value:

./tools/config_tempest.py object-storage.operator_role swiftoperator

For example:
 $ /usr/share/openstack-tempest-*/tools/configure-tempest-directory
 $ python tools/config_tempest.py --debug identity.uri $OS_AUTH_URL \
   identity.admin_password  $OS_PASSWORD \
   object-storage.operator_role swiftoperator --create

This will create tempest.conf containing the right operator role value.