]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use Python 3.x compatible octal literals
authorDirk Mueller <dirk@dmllr.de>
Sat, 8 Jun 2013 11:17:03 +0000 (13:17 +0200)
committerDirk Mueller <dirk@dmllr.de>
Sun, 9 Jun 2013 00:02:39 +0000 (02:02 +0200)
Python 3.x deprecated octal literals in the form 0755.
Use the Python 2.x compatible version 0o755 instead.

Change-Id: I90ea601847752ae04d4e403ffa16a537efe442e2

quantum/agent/dhcp_agent.py
quantum/agent/linux/dhcp.py
quantum/agent/linux/external_process.py
quantum/agent/linux/utils.py
quantum/agent/metadata/agent.py
quantum/plugins/services/agent_loadbalancer/drivers/haproxy/namespace_driver.py
quantum/tests/unit/cisco/test_nexus_plugin.py
quantum/tests/unit/services/agent_loadbalancer/driver/haproxy/test_namespace_driver.py
quantum/tests/unit/test_agent_linux_utils.py
quantum/tests/unit/test_linux_external_process.py
quantum/tests/unit/test_metadata_agent.py

index 88d6e442a11cdf3d644863c4d34265deac61f527..ff1370bea5caa255e6b6484fc31071525c080f46 100644 (file)
@@ -638,7 +638,7 @@ class DhcpLeaseRelay(object):
                 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.
index 732fc1dc5a6f36f0fd4e8dcb959df967637b8787..b4e23dce219eadd28c6a7b1ef29cb0453329315c 100644 (file)
@@ -157,7 +157,7 @@ class DhcpLocalProcess(DhcpBase):
         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)
 
index 5d8d3c2dd39ed8acd328d6c86fcdf6210943561c..9914a31ca1eb71d4cfde87da89fa1b5e6bf1a060 100644 (file)
@@ -73,7 +73,7 @@ class ProcessManager(object):
         """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')
 
index cbfefffebeb46f7e7563f763f459d2716f14bb77..319272f8cdecfc92d94597c9ef0bf4a4266a0a47 100644 (file)
@@ -87,5 +87,5 @@ def replace_file(file_name, data):
     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)
index dfdd52c97d66f5c5725b2edba34d5c34c6cd906f..1c1fed47394af31907e812d805060220683b307e 100644 (file)
@@ -220,7 +220,7 @@ class UnixDomainMetadataProxy(object):
                 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')
index 4c78f755a35f67b66da6d099d9d1439cbad5f7fe..a9f6a621ba988b3d3c003e93e2b0e62dae2c003a 100644 (file)
@@ -150,7 +150,7 @@ class HaproxyNSDriver(object):
         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):
index 3e7912958a931927953e84e07ad80761a3e15860..0e56c4fa65cc453e1100bcd4126a58324d57a609 100644 (file)
@@ -40,11 +40,11 @@ class TestCiscoNexusPlugin(base.BaseTestCase):
         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 = {
index 861104851b90b349c2abcc2acedce946861dd876..bd201034e587a7eab4c65faa6651e7776611cd67 100644 (file)
@@ -286,4 +286,4 @@ class TestHaproxyNSDriver(base.BaseTestCase):
         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)
index 80ada7de3f7116a768ab145a1d2e22b89d9c2ccc..4eeb8f59e5032804037d59f2163092c1c13d010b 100644 (file)
@@ -88,5 +88,5 @@ class AgentUtilsReplaceFile(base.BaseTestCase):
                                 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')
index d0496f29dcc35ad8796a6af25b270cf8eecdcfc9..0900336c2cdc8ec8b5920b5e373c1ed8cd98b7af 100644 (file)
@@ -134,7 +134,7 @@ class TestProcessManager(base.BaseTestCase):
                 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:
index 15ad8b5987473d321081c9c127d9e2a08de42576..a81885b828066d8aa0dfe3bd3cf59e0fa4b16b15 100644 (file)
@@ -308,7 +308,7 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase):
                 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:
@@ -359,7 +359,7 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase):
                         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,