Python 3.x deprecated octal literals in the form 0755.
Use the Python 2.x compatible version 0o755 instead.
Change-Id: I90ea601847752ae04d4e403ffa16a537efe442e2
if os.path.exists(cfg.CONF.dhcp_lease_relay_socket):
raise
else:
- os.makedirs(dirname, 0755)
+ os.makedirs(dirname, 0o755)
def _handler(self, client_sock, client_addr):
"""Handle incoming lease relay stream connection.
conf_dir = os.path.join(confs_dir, self.network.id)
if ensure_conf_dir:
if not os.path.isdir(conf_dir):
- os.makedirs(conf_dir, 0755)
+ os.makedirs(conf_dir, 0o755)
return os.path.join(conf_dir, kind)
"""Returns the file name for a given kind of config file."""
pids_dir = os.path.abspath(os.path.normpath(self.conf.external_pids))
if ensure_pids_dir and not os.path.isdir(pids_dir):
- os.makedirs(pids_dir, 0755)
+ os.makedirs(pids_dir, 0o755)
return os.path.join(pids_dir, self.uuid + '.pid')
tmp_file = tempfile.NamedTemporaryFile('w+', dir=base_dir, delete=False)
tmp_file.write(data)
tmp_file.close()
- os.chmod(tmp_file.name, 0644)
+ os.chmod(tmp_file.name, 0o644)
os.rename(tmp_file.name, file_name)
if os.path.exists(cfg.CONF.metadata_proxy_socket):
raise
else:
- os.makedirs(dirname, 0755)
+ os.makedirs(dirname, 0o755)
def run(self):
server = UnixDomainWSGIServer('quantum-metadata-agent')
conf_dir = os.path.join(confs_dir, pool_id)
if ensure_state_dir:
if not os.path.isdir(conf_dir):
- os.makedirs(conf_dir, 0755)
+ os.makedirs(conf_dir, 0o755)
return os.path.join(conf_dir, kind)
def _plug(self, namespace, port, reuse_existing=True):
super(TestCiscoNexusPlugin, self).setUp()
self.tenant_id = "test_tenant_cisco1"
self.net_name = "test_network_cisco1"
- self.net_id = 000007
+ self.net_id = 7
self.vlan_name = "q-" + str(self.net_id) + "vlan"
self.vlan_id = 267
self.second_net_name = "test_network_cisco2"
- self.second_net_id = 000005
+ self.second_net_id = 5
self.second_vlan_name = "q-" + str(self.second_net_id) + "vlan"
self.second_vlan_id = 265
self._nexus_switches = {
with mock.patch('os.makedirs') as mkdir:
path = self.driver._get_state_file_path('pool_id', 'conf')
self.assertEqual('/the/path/pool_id/conf', path)
- mkdir.assert_called_once_with('/the/path/pool_id', 0755)
+ mkdir.assert_called_once_with('/the/path/pool_id', 0o755)
mock.call().close()]
ntf.assert_has_calls(expected)
- chmod.assert_called_once_with('/baz', 0644)
+ chmod.assert_called_once_with('/baz', 0o644)
rename.assert_called_once_with('/baz', '/foo')
manager = ep.ProcessManager(self.conf, 'uuid')
retval = manager.get_pid_file_name(ensure_pids_dir=True)
self.assertEqual(retval, '/var/path/uuid.pid')
- makedirs.assert_called_once_with('/var/path', 0755)
+ makedirs.assert_called_once_with('/var/path', 0o755)
def test_get_pid_file_name_default(self):
with mock.patch.object(ep.os.path, 'isdir') as isdir:
agent.UnixDomainMetadataProxy(mock.Mock())
isdir.assert_called_once_with('/the')
- makedirs.assert_called_once_with('/the', 0755)
+ makedirs.assert_called_once_with('/the', 0o755)
def test_init_exists(self):
with mock.patch('os.path.isdir') as isdir:
p.run()
isdir.assert_called_once_with('/the')
- makedirs.assert_called_once_with('/the', 0755)
+ makedirs.assert_called_once_with('/the', 0o755)
server.assert_has_calls([
mock.call('quantum-metadata-agent'),
mock.call().start(handler.return_value,