summaryrefslogtreecommitdiff
path: root/pycadf/identifier.py
Commit message (Collapse)AuthorAgeFilesLines
* Enabling FIPS mode by using sha256 instead of md5Raildo Mascena2018-11-011-2/+2
| | | | | | | | | | FIPS does not allow md5, some systems like RHEL needs to have FIPS compliance, in order to execute some routines like when try to use keystone-manage. As a general rule, we should avoid using md5 if we can and move over to SHA wherever possible. Change-Id: Icaeb3305c788db2913fe99792ea6311d218b3410 Closes-Bug: #1767024
* Stopping using norm_nschenghuiyu2017-09-131-8/+0
| | | | | | | | | | The usage of 'norm_ns' via identifier is deprecated for removal. And there is no usage of norm_ns in other projects [1]. It's safe to remove it now. [1] http://codesearch.openstack.org/?q=norm_ns&i=nope&files=&repos= Change-Id: I9dc7683cb2cfa9096c16b888518581ed57c6dd9d
* Make `is_valid` more flexible with uuid validationGage Hugo2017-02-061-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In keystone, multiple domain ids are handled by concatenating two valid uuids together. This causes issues with pycadf validation and causes the following warning to be thrown: warnings.warn('Invalid uuid. To ensure interoperability, identifiers ' 'should be a valid uuid.') This appears throughout the testing logs while running keystone tests and there is a current attempt to remove most/all invalid uuids to eliminate this warning [0]. However due to the multiple domain id issue, this cannot be solved in keystone alone. The idea to allow multiple uuids that were joined together was mentioned before in a previous attempt to solve this issue [1]. This change: - Allows 2 or more concatenated uuids to be considered valid without emitting a warning - Cleaned up the list of words that are exceptions for validation - Added 'default' to list of valid words in exception list - Added offending value to printed warning - Broke up test_identifiers for better clarity about which tests were valid. This also solves the issue of `warning_mock.called` always being `True` once an invalid uuid of type string was checked within test_identifier - Added test for valid exception words and extra characters that can be present in a valid uuid according to [2] [0] https://bugs.launchpad.net/keystone/+bug/1659053 [1] https://bugs.launchpad.net/keystone/+bug/1521844 [2] https://docs.python.org/2/library/uuid.html Co-Authored-By: Tin Lam <tinlam@gmail.com> Partial-Bug: #1659053 Change-Id: I58bba04c21c2d24fd37850c9ecc6fac99deb3fc4
* cleanup stringgord chung2017-01-041-1/+1
| | | | Change-Id: I5df26a59aa1437777f175f46fd24e59b903e53a2
* Add docstring validationDolph Mathews2016-02-121-5/+3
| | | | | | | | | | | | This introduces a linter for PEP257 to avoid trivial nitpicking of docstrings in code reviews. Because flake8_docstrings simply provides a plugin to add pep257 to flake8, you can run it via `tox -e pep8`. PEP257 checks which we are currently violating are ignored in tox.ini. We can remove them from the ignored list as they are fixed. Related-Bug: 1501544 Change-Id: I01ebad7b70cf61dd80d3c06c6808d8178fbdd634
* relax id validation2.0.1gordon chung2015-12-021-4/+8
| | | | | | | | | we want uuid, unfortunately most of openstack is a mess so we can't have nice things. this patch makes it so we continue to allow basically anything that is a string but we warn that they should stop this. Change-Id: I2a89aed143c22b9a3e2261d5473af93c1cad67cd Closes-Bug: #1521844
* make generate_uuid return valid uuidgordon chung2015-11-121-14/+20
| | | | | | | | | | | | original design prepended a namespace to the beginning of uuid. this scoped the uuid to a namespace but it is technically invalid. this patch drops the behaviour of prepending string. rather, it takes the namespace, hashes it, and uses uuid v5 to generate valid uuid based on that namespace Change-Id: Ibde222c91522fa3c4a1720b6a8da81dac31560b9 Closes-Bug: #1504889
* ensure id is not emptygordon chung2015-06-221-0/+2
| | | | | | | | when validating id, we should validate it's not just a string but that it's also not empty. Change-Id: I0d55803df5f2f8e6b35431a816e1390bcb3fe424 Closes-Bug: #1467670
* Use oslo namespacesSteve Martinelli2015-02-041-1/+1
| | | | | | | | | | Instead of using imports like: import oslo.config we should be using: import oslo_config Change-Id: I11fe1dbb0d638b9cc6d65fcdb1c1482cdf0c40b9
* clean up license headersDolph Mathews2014-07-291-9/+6
| | | | | | | | | | This removes extraneous whitespace, applies a consistent licensing header to all files, removes "all rights reserved" lines attributed to the OpenStack Foundation, removes authorship lines for Matt Rutkowski (which the git commit history much more accurately conveys) and follows all licenses with a blank line before the code/docstr begins. Change-Id: Idcfefd923e5ddb574087265c998dd50ebfe70a79
* Enabled hacking checks H305 and H307Christian Berendt2014-07-171-1/+1
| | | | | | | * H305 imports not grouped correctly * H307 like imports should be grouped together Change-Id: Ied0e83b9b37dcb7a7a60a653093c3fa0d8e56226
* Expand © and remove unnecessary encoding linesMartin Geisler2014-06-151-1/+0
| | | | | | | | | | | | | | | | | | The word "Copyright" alone is sufficient to claim copyright, the © symbol need not be present.[1] This allows us to expand the "©" symbol into "(c)" to avoid introducing non-ASCII characters. As per PEP 263, a Python file with non-ASCII characters must have a line with "coding: <some-encoding>". Python files containing only 7-bit ASCII characters need no such line.[2] This commit expands the non-ASCII Unicode copyright symbols and removes the now unnecessary encoding lines. [1]: http://www.copyright.gov/circs/circ03.pdf [2]: http://legacy.python.org/dev/peps/pep-0263/ Change-Id: Ibbb282224bccbea383947b4e09a619f94d5c24b1
* add docstrings to functionsGordon Chung2014-03-101-0/+6
| | | | | | | add docstrings to functions Change-Id: I112e297d20de5026784298e93b6ff05733639a1c Implements: blueprint document-pycadf
* Python 3: replace 'basestring' by 'six.string_types'Cyril Roelandt2014-01-061-1/+3
| | | | | | | 'basestring' will only work in Python 2. Using 'six.string_types' instead makes the code compatible with both Python 2 and 3. Change-Id: I572506ce6d0cc7570dc264711d19619746949d49
* add namespace to all idsGordon Chung2013-10-291-1/+5
| | | | | | add namespace to all ids, including those not generated by pycadf Change-Id: I9ba68a65524708c4f0749540ad25811f8cb3355f
* support namespace prefix in idGordon Chung2013-10-171-9/+11
| | | | | | prefix generated ids with namespace option Change-Id: I50776202dd5be1b9ab2cfc5e177eeb9a77d6a8f9
* validate attributes against basestring0.1.10.1Gordon Chung2013-08-071-1/+1
| | | | | | | | | - need to update attribute validation to test against basestring instead of str - drop use of openstack logger Change-Id: I2167cf8e468c0e932c476238120d768e5d4d443f Fixes: bug1209387
* DMTF CADF formatGordon Chung2013-08-061-0/+42
Adding support for the DMTF Cloud Audit (CADF) format which will be used along with a generic notification filter to audit 'core' component APIs. initial code drop blueprint support-standard-audit-formats Change-Id: I3b27ceae8faa6427e4be1290c1406102e790e2e3