230 Commits

Author SHA1 Message Date
Joshua Harlow
3a7fca5e9d Add missing reflection + uuidutils docs
These do not seem to have been created and
made appear, so make them appear and make sure
the exposed public API(s) have docstrings so
that they appear in the generated docs.

Change-Id: Ie34e46647b0b20d936ddaa15dc824d0e2d2ca99d
2015-04-13 10:49:20 -07:00
Jenkins
8c4bae3158 Merge "timeutils: avoid passing leap second to datetime" 2015-04-13 00:54:43 +00:00
Jenkins
61be45f9a0 Merge "add dependency warning to requirements.txt" 2015-04-10 21:05:30 +00:00
Ihar Hrachyshka
c50d8161ac timeutils: avoid passing leap second to datetime
Python datetime module does not support leap seconds [1]. The best thing
we can do without switching API to using another time module is to
avoid passing leap seconds to underlying python module.

Note: next leap second is scheduled for June 30 [2].

[1]: http://bugs.python.org/issue23574
[2]: http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/

Closes-Bug: #1427212
Change-Id: I7ffd8121cb20f3742e8e9cd7d4b8f0f15fa6ca9a
2015-04-10 17:15:31 +02:00
Joshua Harlow
cb88d17a36 Add pypi download + version badges
Also makes the docs look more like the other
oslo libraries so that the content is easily readable
across projects.

Change-Id: I85158a89f103cdef2afa268558592c46ce6c3411
2015-04-07 18:19:37 -07:00
Steve Martinelli
6ab5ae239f Cleanup README.rst and setup.cfg
Provide a more complete description in README.rst, which is used
when viewing the library on pypi.

Also standardize the short-description used in setup.cfg.

Change-Id: Ief38e3f75918c94a143d9369756747a24bb778b0
2015-04-04 02:22:36 -04:00
Doug Hellmann
597d5dd4f1 Update hacking setting
Change-Id: I1fbed5b29794f523c0c7746a87c58ecc85292a66
2015-04-03 12:27:59 +00:00
OpenStack Proposal Bot
a649d55fe6 Updated from global requirements
Change-Id: Id8e1761be8c1beec1f653cf93059451a235ceca7
2015-03-28 02:34:31 +00:00
Jenkins
0888108c36 Merge "Clean up TestIsIPv6Enabled" 2015-03-26 16:34:23 +00:00
OpenStack Proposal Bot
69526a1dd4 Imported Translations from Transifex
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I1de32ea719d83d0744afa71c44830b9c448ea47a
2015-03-26 06:12:10 +00:00
Jenkins
f3a25c519b Merge "Add a new string to the list of masked patterns" 2015-03-25 17:53:20 +00:00
Doug Hellmann
782e41f62e Clean up TestIsIPv6Enabled
The earlier patch fixed a logic error with the way mocks were handled in
TestIsIPv6Enabled. This patch replaces fixtures with method decorators
to do the mocking, bringing the mock definition closer to the function
that is using it.

Change-Id: I9f5649c73da2e5db7edee53dc6a4cbb26e4f675b
2015-03-23 17:53:49 +00:00
Victor Stinner
b200da826c Fix test_netutils: stop patches
test_netutils monkey patches os.path.exists() and
six.moves.builtins.open() using mock, but it didn't stop the patchs.

A side effect is that test_excutils started to fail when executed after
test_netutils. Randomly, test_excutils was executed before or after
test_netutils, so test_excutils failure was random.

Closes-Bug: #1433800
Change-Id: Ifbe79c52f34b4373721e9aa2e22eb86f39b60b87
2015-03-23 14:37:56 +01:00
Jenkins
0560dce82f Merge "Provide common fetch_current_thread_functor function" 2015-03-19 11:30:37 +00:00
Amrith Kumar
4ab214e733
Add a new string to the list of masked patterns
The string sys_pswd is a new key that I'd like to mask. Adding it to
the list.

Change-Id: I20ab4a54dfc9caece6d1eb9fc54d5c258fd54376
2015-03-18 12:37:01 -04:00
Joshua Harlow
1a6dc73254 Provide common fetch_current_thread_functor function
This code is appearing in various projects (currently
oslo.messaging, taskflow, oslo.concurrency) and it seems
better placed in this little utility helper to avoid
people from duplicating it.

Change-Id: I177d79d4561b3eb13822d3e2ae4a9fbe011f586a
2015-03-16 15:33:18 -07:00
OpenStack Proposal Bot
6fe565d9b4 Imported Translations from Transifex
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: Ie9573279b47edc947dc01278fbaa99d4fb768eec
2015-03-16 06:11:07 +00:00
Jenkins
91dc782c2f Merge "Add a stopwatch + split for duration(s)" 1.4.0 2015-03-05 21:21:13 +00:00
Jenkins
64dd7b1808 Merge "Allow providing a logger to save_and_reraise_exception" 2015-03-05 18:44:52 +00:00
Joshua Harlow
548b640208 Add a stopwatch + split for duration(s)
The existing timeutils provides a way to measure durations
that is also used to get actual times and dates; for most
cases this dual ability is not needed and the user only cares
about the duration between two time points. In cases where
ntpd may affect the machine clock this usage is also incorrect
and may go backwards in time...

To support this kind of specific and frequently occurring usage
a stopwatch class can be used that can enable more accurate
gathering of *just* durations (and using monotonic time when
it's available in python 3.3+ or optionally when the library
at http://pypi.python.org/pypi/monotonic is installed).

This code comes from taskflow, but oslo.messaging has similar
code that they could replace with this (and I imagine tooz
could also use this); among others...

Change-Id: I950e26c1eb8283a134fb4f16544f87bc5d29fd82
2015-03-04 12:46:54 -08:00
Jenkins
a9c620733b Merge "Utility API to generate EUI-64 IPv6 address" 2015-03-02 07:26:47 +00:00
Joshua Harlow
2e6517151e Allow providing a logger to save_and_reraise_exception
Instead of always assuming the best logger to use when
a exception is being dropped is the root logger (which
it may not always be) allow for providing a custom
logger when using this functionality + class so that
users can direct it to a logger of there choosing.

Change-Id: Ic56892be9d007229f5c302a2c6da19f00e91752e
2015-02-24 12:58:18 -08:00
OpenStack Proposal Bot
db5a0c6284 Updated from global requirements
Change-Id: I44625894bb50404c2f38726111da0b0e4ad6c8b6
2015-02-20 13:59:02 +00:00
sridhargaddam
9d9818bf48 Utility API to generate EUI-64 IPv6 address
For a network using IPv6 SLAAC, Neutron would calculate the port
addresses based on EUI-64 specification which is generated via
IPv6 prefix and the interface MAC address. EUI-64 is a standard
algorithm and is explained at the following url
http://packetlife.net/blog/2008/aug/4/eui-64-ipv6

This utility api is present in both Neutron [1] and Tempest [2] to
validate certain IPv6 scenarios. Hence, having it in oslo.utils
would be ideal.

[1] - https://github.com/openstack/neutron/blob/master/neutron/common/ipv6_utils.py#L32
[2] - https://github.com/openstack/tempest/blob/master/tempest/common/utils/data_utils.py#L85

Change-Id: I3d1c6b22ecddf7faad83cc12c674a9c5c96b1759
2015-02-18 19:55:28 +00:00
Jenkins
8a5a4d87da Merge "Add a eventlet utils helper module" 1.3.0 2015-02-10 22:57:47 +00:00
Joshua Harlow
ed4e2d775a Add a eventlet utils helper module
When greenthreads are being used (and/or eventlet is available and
some modules have been monkey-patched) emit warnings to the users
that certain modules should be monkey-patched and if they are not
then spurious or unexpected lock-ups and/or hangs may result due to
this type of mixed usage which doesn't typically end well.

This commit adds that functionality to a new eventlet utils module
that can be used by calling code when that code really knows it will
not work without modules being patched or partially being patched.

Change-Id: I9a856fc0a6502b438c8da9b2f589154a6fa89a9f
2015-02-10 12:57:28 -08:00
Jenkins
50488e2573 Merge "Update Oslo imports to remove namespace package" 2015-02-08 14:56:40 +00:00
Paul Belanger
d5e2009ddd Add microsecond support to iso8601_from_timestamp
We now have the ability to generate iso8601 dates, with microseconds,
from timestamps.

Change-Id: I2d87fa22148098d428115bfcd0b4ce3879a07c38
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2015-02-05 10:13:19 -05:00
Doug Hellmann
e1bc333fbd add dependency warning to requirements.txt
Change-Id: I873cf64c4ea3bf8fd16bfce7da54f153a52b02d1
2015-01-28 13:44:59 -05:00
OpenStack Proposal Bot
ff05ecc7ea Updated from global requirements
Change-Id: Idf7ff1d21b0ccf22a16859ec53409c0250c39ee2
2015-01-23 04:37:45 +00:00
Doug Hellmann
9174de810b Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages
2015-01-21 19:56:45 -05:00
Brant Knudson
89d0c2a88c Add TimeFixture
There was no fixture for using the functions related to
timeutils.set_time_override. A fixture is handy because
clear_time_override must be done for cleanup.

Change-Id: Ifef8d9f20fa9e5aa96ebf5040f290f65b503f0bd
2015-01-16 16:19:54 -06:00
Paul Belanger
659e12bddd Add microsecond support to timeutils.utcnow_ts()
Now we have the ability to generate a timestamp with microseconds.

Change-Id: I34d51b71c01df02bef46639149fde08f89f0e110
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2015-01-15 22:24:11 -05:00
Dan Prince
942cf060a1 Make setup.cfg packages include oslo.utils
This properly deploys the oslo.utils package may resolve
sphinx build errors for projects which have not yet
upgraded to oslo_utils.

Change-Id: I4db750fb2356ebf44a8fccf7c422b474fefec0ee
2015-01-12 21:20:26 -05:00
Jenkins
82085012e1 Merge "fix link to bug tracker in README" 2015-01-12 03:49:05 +00:00
Ben Nemec
208988b0e9 Return LOCALHOST if no default interface
If no default interface is available in netutils._get_my_ipv4_address(),
return LOCALHOST immediately. Without this change, an UnboundLocalError
exception will be raised instead.

Co-Authored-By: Ruby Loo <rloo@yahoo-inc.com>
Change-Id: I098450c32ef8ad467298c845dd0122da3e3cda3e
Closes-Bug: #1405217
Closes-Bug: #1408701
1.2.1
2015-01-08 18:04:35 +00:00
Doug Hellmann
dbc5700ddb fix link to bug tracker in README
Change-Id: I4eab91a4266573f2ae6cfe1b639435bf722daa0d
2015-01-08 09:07:22 -05:00
Doug Hellmann
6e0b86164b Improve performance of strutils.mask_password
Only apply substitution patterns related to key values that appear in
the string.

Replace .*? in patterns with more explicit patterns that don't require
backtracing.

Add a performance test script for future testing work, with references
to large data files that can be downloaded but that we don't want to
check into the source repository because of their sizes.

Change-Id: Ic3ed252d181c93b8a0db465db6c8c4a7ca97da42
Related-bug: #1408362
1.2.0 1.1.1
2015-01-07 14:12:26 -05:00
Doug Hellmann
ca76fdcb52 Move files out of the namespace package
Move the public API out of oslo.utils to oslo_utils. Retain the ability
to import from the old namespace package for backwards compatibility for
this release cycle.

bp/drop-namespace-packages

Change-Id: Ic6dd62097399bf75e3d11b4d8a6400971069c415
2015-01-06 17:07:36 -05:00
ChangBo Guo(gcb)
44f36e35ec Add method is_valid_port in netutils
Glance[1] and Neutron[2] need to check if a value is a valid port,
so we place the common code in oslo.utils.

[1] https://git.openstack.org/cgit/openstack/glance/tree/glance/common/utils.py#n550
[2] https://git.openstack.org/cgit/openstack/neutron/tree/neutron/extensions/securitygroup.py#n142

Change-Id: I156035396b4f686589b6f7ddfbdb0c922b8d90a0
2015-01-06 14:16:37 +08:00
Jenkins
058ee53a69 Merge "Add 'secret_uuid' in _SANITIZE_KEYS for strutils" 2015-01-05 22:51:46 +00:00
Cedric Brandily
626368a9a9 Support non-lowercase uuids in is_uuid_like
According to RFC 4122 (on uuid), uuids are case insensitive but
currently is_uuid_like returns False if the input is a non-lowercase
string. This change adds non-lowercase uuid support in is_uuid_like.

Change-Id: Ie017e183c3ee36b8dea9c1aa82cdb697c26bbf17
Closes-Bug: #1405624
2014-12-26 16:22:24 +01:00
ChangBo Guo(gcb)
45b470cd60 Add 'secret_uuid' in _SANITIZE_KEYS for strutils
Cinder volume drivers rbd may return connection_info with'secret_uuid',
This is an example[1], to avoid secret_uuid to be logged in disk,
we should mask its value with "***".

[1]https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/rbd.py#L745

Change-Id: I5c9d688126f3dbcebc67162e749da9a34a4bb2b9
2014-12-18 17:00:25 +08:00
OpenStack Proposal Bot
2081aa9cde Imported Translations from Transifex
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I162a8c79c387c8bc056a76cd4c7423e53bce7fd2
2014-12-10 06:12:09 +00:00
Jenkins
a2a9b828f5 Merge "Workflow documentation is now in infra-manual" 2014-12-05 20:55:10 +00:00
Jenkins
8e5905636f Merge "Improve error reporting in _get_my_ipv4_address()" 2014-12-05 09:57:51 +00:00
Jeremy Stanley
6741748e77 Workflow documentation is now in infra-manual
Replace URLs for workflow documentation to appropriate parts of the
OpenStack Project Infrastructure Manual.

Change-Id: I888d3e2905755ae7833231363d5dab66799a4a48
2014-12-05 03:30:39 +00:00
Jenkins
11a588787c Merge "Add pbr to installation requirements" 1.1.0 2014-11-19 23:07:58 +00:00
Jenkins
0394f71230 Merge "Add get_my_ip()" 2014-11-19 19:09:28 +00:00
Doug Hellmann
edfc2c75fb Improve error reporting in _get_my_ipv4_address()
Provide more detailed error reporting when we cannot figure out what the
IPv4 address of the server is.

Change-Id: Ifac8a2109ae00c9c2624e03725f41b6052890f77
2014-11-19 12:45:04 -05:00