Updated from global requirements
Change-Id: Ibf423f14a5c37aa298b2115bfd4936f660c6f530
This commit is contained in:
parent
e8b3360038
commit
dc266f44e7
@ -189,8 +189,8 @@ class SecretKeyTests(test.TestCase):
|
|||||||
self.assertEqual(key, secret_key.generate_or_read_from_file(key_file))
|
self.assertEqual(key, secret_key.generate_or_read_from_file(key_file))
|
||||||
|
|
||||||
# Key file only be read/writable by user:
|
# Key file only be read/writable by user:
|
||||||
self.assertEqual(oct(os.stat(key_file).st_mode & 0777), "0600")
|
self.assertEqual(oct(os.stat(key_file).st_mode & 0o777), "0600")
|
||||||
os.chmod(key_file, 0777)
|
os.chmod(key_file, 0o777)
|
||||||
self.assertRaises(secret_key.FilePermissionError,
|
self.assertRaises(secret_key.FilePermissionError,
|
||||||
secret_key.generate_or_read_from_file, key_file)
|
secret_key.generate_or_read_from_file, key_file)
|
||||||
os.remove(key_file)
|
os.remove(key_file)
|
||||||
|
@ -55,12 +55,12 @@ def generate_or_read_from_file(key_file='.secret_key', key_length=64):
|
|||||||
with lock:
|
with lock:
|
||||||
if not os.path.exists(key_file):
|
if not os.path.exists(key_file):
|
||||||
key = generate_key(key_length)
|
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:
|
with open(key_file, 'w') as f:
|
||||||
f.write(key)
|
f.write(key)
|
||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
else:
|
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!")
|
raise FilePermissionError("Insecure key file permissions!")
|
||||||
with open(key_file, 'r') as f:
|
with open(key_file, 'r') as f:
|
||||||
key = f.readline()
|
key = f.readline()
|
||||||
|
@ -172,7 +172,8 @@ class CreateSubnetDetailAction(workflows.Action):
|
|||||||
return netaddr.IPAddress(ip)
|
return netaddr.IPAddress(ip)
|
||||||
except (netaddr.AddrFormatError, ValueError):
|
except (netaddr.AddrFormatError, ValueError):
|
||||||
msg = _('%(field_name)s: Invalid IP address '
|
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)
|
raise forms.ValidationError(msg)
|
||||||
|
|
||||||
def _convert_ip_network(self, network, field_name):
|
def _convert_ip_network(self, network, field_name):
|
||||||
@ -180,7 +181,8 @@ class CreateSubnetDetailAction(workflows.Action):
|
|||||||
return netaddr.IPNetwork(network)
|
return netaddr.IPNetwork(network)
|
||||||
except (netaddr.AddrFormatError, ValueError):
|
except (netaddr.AddrFormatError, ValueError):
|
||||||
msg = _('%(field_name)s: Invalid IP address '
|
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)
|
raise forms.ValidationError(msg)
|
||||||
|
|
||||||
def _check_allocation_pools(self, allocation_pools):
|
def _check_allocation_pools(self, allocation_pools):
|
||||||
|
27
openstack_dashboard/hooks.py
Normal file
27
openstack_dashboard/hooks.py
Normal 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']
|
@ -1,11 +1,10 @@
|
|||||||
d2to1>=0.2.10,<0.3
|
pbr>=0.5.21,<1.0
|
||||||
pbr>=0.5.16,<0.6
|
|
||||||
# Horizon Core Requirements
|
# Horizon Core Requirements
|
||||||
django>=1.4,<1.6
|
Django>=1.4,<1.6
|
||||||
django_compressor>=1.3
|
django_compressor>=1.3
|
||||||
django_openstack_auth>=1.0.11,!=1.1.0
|
django_openstack_auth>=1.1.1
|
||||||
eventlet>=0.12.0
|
eventlet>=0.13.0
|
||||||
kombu>2.4.7
|
kombu>=2.4.8
|
||||||
iso8601>=0.1.4
|
iso8601>=0.1.4
|
||||||
netaddr
|
netaddr
|
||||||
python-cinderclient>=1.0.4
|
python-cinderclient>=1.0.4
|
||||||
|
@ -25,7 +25,7 @@ classifier =
|
|||||||
|
|
||||||
[global]
|
[global]
|
||||||
setup-hooks =
|
setup-hooks =
|
||||||
pbr.hooks.setup_hook
|
openstack_dashboard.hooks.setup_hook
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
|
12
setup.py
12
setup.py
@ -14,15 +14,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from distutils.command import install
|
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||||
import setuptools
|
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(
|
setuptools.setup(
|
||||||
setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5,<0.6'],
|
setup_requires=['pbr>=0.5.21,<1.0'],
|
||||||
d2to1=True)
|
pbr=True)
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# Install bounded pep8/pyflakes first, then let flake8 install
|
hacking>=0.5.6,<0.7
|
||||||
pep8==1.4.5
|
|
||||||
pyflakes==0.7.2
|
|
||||||
flake8==2.0
|
|
||||||
hacking>=0.5.3,<0.6
|
|
||||||
# Testing Requirements
|
# Testing Requirements
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
django-nose
|
django-nose
|
||||||
|
3
tox.ini
3
tox.ini
@ -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
|
# E128 continuation line under-indented for visual indent
|
||||||
# F403 'from <smth> import *' used; unable to detect undefined names
|
# F403 'from <smth> import *' used; unable to detect undefined names
|
||||||
# F999 syntax error in doctest
|
# F999 syntax error in doctest
|
||||||
|
# H102 Apache 2.0 license header not found
|
||||||
# H201 no 'except:' at least use 'except Exception:'
|
# H201 no 'except:' at least use 'except Exception:'
|
||||||
# H302 import only modules.'from optparse import make_option' does not import a module
|
# H302 import only modules.'from optparse import make_option' does not import a module
|
||||||
# H4xx docstrings
|
# H4xx docstrings
|
||||||
# H701 empty localization string
|
# H701 empty localization string
|
||||||
# H702 Formatting operation should be outside of localization method call
|
# 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
|
||||||
|
Loading…
Reference in New Issue
Block a user