Skip to content

Commit

Permalink
OPSAPS-26038. Conditionalize 'roles' argument.
Browse files Browse the repository at this point in the history
Tests running against older CM versions had the following
error:
    test_support_bundle45 fails with error: Unrecognized property: 'roles' (error 400)

As it turns out, we have the capability to set an API
version when using the python client, and the client
should take care of things like this, so I've done so.

To test this, I ran:

  $ cp ~/src/cm_api/python/src/cm_api/endpoints/cms.py ./target/env/lib/python2.7/site-packages/cm_api/endpoints/cms.py
  $ systest.py --agents="cdh5+parcels@nightly53-{1..4}.ent.cloudera.com" run_tests -n "test_support_bundle:SupportBundleTests.test_support_bundle_45" --disable-pre-validations  --version cm53

Before my change (that I manually cherrypicked in the first hand):

        ApiException: Unrecognized property: 'roles' (error 400)

        ----------------------------------------------------------------------
        Ran 1 test in 0.499s

        FAILED (errors=1)
        False

After:

    ***********************************************************************
    * End test_support_bundle_45 (test_support_bundle.SupportBundleTests) *
    ***********************************************************************

    ----------------------------------------------------------------------
    Ran 1 test in 128.929s

I also tested against nightly (5.5) to make sure this didn't regress.
It passed.

    $./systest.py --agents="cdh5+parcels@nightly-{1..4}.ent.cloudera.com" run_tests -n "test_support_bundle:SupportBundleTests.test_support_bundle_45"
    --disable-pre-validations

(cherry picked from commit e58b3cc)
  • Loading branch information
Philip Zeyliger committed Apr 13, 2015
1 parent 9996d8b commit 0d437f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/src/cm_api/endpoints/cms.py
Expand Up @@ -201,9 +201,10 @@ def collect_diagnostic_data_45(self, end_datetime, bundle_size_bytes, cluster_na
args = {
'endTime': end_datetime.isoformat(),
'bundleSizeBytes': bundle_size_bytes,
'clusterName': cluster_name,
'roles': roles
'clusterName': cluster_name
}
if self._get_resource_root().version >= 10:
args['roles'] = roles
return self._cmd('collectDiagnosticData', data=args)

def hosts_decommission(self, host_names):
Expand Down

0 comments on commit 0d437f9

Please sign in to comment.