Updated from global requirements

Change-Id: Ibf423f14a5c37aa298b2115bfd4936f660c6f530
This commit is contained in:
Monty Taylor 2013-08-08 10:42:33 -03:00
parent e8b3360038
commit dc266f44e7
9 changed files with 48 additions and 28 deletions

View File

@ -189,8 +189,8 @@ class SecretKeyTests(test.TestCase):
self.assertEqual(key, secret_key.generate_or_read_from_file(key_file))
# Key file only be read/writable by user:
self.assertEqual(oct(os.stat(key_file).st_mode & 0777), "0600")
os.chmod(key_file, 0777)
self.assertEqual(oct(os.stat(key_file).st_mode & 0o777), "0600")
os.chmod(key_file, 0o777)
self.assertRaises(secret_key.FilePermissionError,
secret_key.generate_or_read_from_file, key_file)
os.remove(key_file)

View File

@ -55,12 +55,12 @@ def generate_or_read_from_file(key_file='.secret_key', key_length=64):
with lock:
if not os.path.exists(key_file):
key = generate_key(key_length)
old_umask = os.umask(0177) # Use '0600' file permissions
old_umask = os.umask(0o177) # Use '0600' file permissions
with open(key_file, 'w') as f:
f.write(key)
os.umask(old_umask)
else:
if oct(os.stat(key_file).st_mode & 0777) != '0600':
if oct(os.stat(key_file).st_mode & 0o777) != '0600':
raise FilePermissionError("Insecure key file permissions!")
with open(key_file, 'r') as f:
key = f.readline()

View File

@ -172,7 +172,8 @@ class CreateSubnetDetailAction(workflows.Action):
return netaddr.IPAddress(ip)
except (netaddr.AddrFormatError, ValueError):
msg = _('%(field_name)s: Invalid IP address '
'(value=%(ip)s)') % locals()
'(value=%(ip)s)' % dict(
field_name=field_name, ip=ip))
raise forms.ValidationError(msg)
def _convert_ip_network(self, network, field_name):
@ -180,7 +181,8 @@ class CreateSubnetDetailAction(workflows.Action):
return netaddr.IPNetwork(network)
except (netaddr.AddrFormatError, ValueError):
msg = _('%(field_name)s: Invalid IP address '
'(value=%(network)s)') % locals()
'(value=%(network)s)' % dict(
field_name=field_name, network=network))
raise forms.ValidationError(msg)
def _check_allocation_pools(self, allocation_pools):

View File

@ -0,0 +1,27 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from distutils.command import install
def setup_hook(config):
"""Filter config parsed from a setup.cfg to inject our defaults."""
# Tell distutils not to put the data_files in platform-specific
# installation locations. See here for an explanation:
# https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw
for scheme in install.INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']

View File

@ -1,11 +1,10 @@
d2to1>=0.2.10,<0.3
pbr>=0.5.16,<0.6
pbr>=0.5.21,<1.0
# Horizon Core Requirements
django>=1.4,<1.6
Django>=1.4,<1.6
django_compressor>=1.3
django_openstack_auth>=1.0.11,!=1.1.0
eventlet>=0.12.0
kombu>2.4.7
django_openstack_auth>=1.1.1
eventlet>=0.13.0
kombu>=2.4.8
iso8601>=0.1.4
netaddr
python-cinderclient>=1.0.4

View File

@ -25,7 +25,7 @@ classifier =
[global]
setup-hooks =
pbr.hooks.setup_hook
openstack_dashboard.hooks.setup_hook
[files]
packages =

View File

@ -14,15 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from distutils.command import install
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# Tell distutils not to put the data_files in platform-specific installation
# locations. See here for an explanation:
# https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw
for scheme in install.INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
setuptools.setup(
setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5,<0.6'],
d2to1=True)
setup_requires=['pbr>=0.5.21,<1.0'],
pbr=True)

View File

@ -1,8 +1,5 @@
# Install bounded pep8/pyflakes first, then let flake8 install
pep8==1.4.5
pyflakes==0.7.2
flake8==2.0
hacking>=0.5.3,<0.6
hacking>=0.5.6,<0.7
# Testing Requirements
coverage>=3.6
django-nose

View File

@ -38,9 +38,10 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p
# E128 continuation line under-indented for visual indent
# F403 'from <smth> import *' used; unable to detect undefined names
# F999 syntax error in doctest
# H102 Apache 2.0 license header not found
# H201 no 'except:' at least use 'except Exception:'
# H302 import only modules.'from optparse import make_option' does not import a module
# H4xx docstrings
# H701 empty localization string
# H702 Formatting operation should be outside of localization method call
ignore = E121,E126,E127,E128,F403,F999,H201,H302,H4,H701,H702
ignore = E121,E126,E127,E128,F403,F999,H102,H201,H302,H4,H701,H702