Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-flock / stx-update / files / 0004-Address-python3-pylint-errors-and-warnings.patch
1 From d6675196199ddcefccba0d5d745ac4e93aaecd0f Mon Sep 17 00:00:00 2001
2 From: Don Penney <don.penney@windriver.com>
3 Date: Wed, 4 Dec 2019 22:26:52 -0500
4 Subject: [PATCH] Address python3 pylint errors and warnings
5
6 This commit addresses issues detected by the updated python3 pylint:
7 - Added a return code to the report_app_dependencies function to
8 satisfy the E1111 error reported.
9 - Added line-specific pylint disable for unused-argument for cases
10 where the inclusion of such arguments in the function signature was
11 intentional.
12 - Added line-specific pylint disable for the duplicate-except case
13 found, as python3 has merged IOError into OSError, while these are
14 separate exceptions in python2. Once we're running solely on python3,
15 this duplicate exception handling can be dropped.
16
17 Change-Id: I96a521288e71948f06ad0c88a12c8f475ed8bc99
18 Closes-Bug: 1855180
19 Signed-off-by: Don Penney <don.penney@windriver.com>
20
21 ---
22  cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py        | 4 ++--
23  cgcs-patch/cgcs-patch/cgcs_patch/messages.py                    | 2 +-
24  cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py                 | 6 +++---
25  cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py                | 6 +++---
26  cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py            | 8 +++++---
27  cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py             | 2 +-
28  cgcs-patch/cgcs-patch/cgcs_patch/tests/test_patch_controller.py | 2 +-
29  cgcs-patch/cgcs-patch/pylint.rc                                 | 6 +-----
30  8 files changed, 17 insertions(+), 19 deletions(-)
31
32 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
33 index f1e0262..4c7bd7f 100644
34 --- a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
35 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
36 @@ -182,7 +182,7 @@ class PatchAPIController(object):
37  
38      @expose('json')
39      @expose('query_hosts.xml', content_type='application/xml')
40 -    def query_hosts(self, *args):
41 +    def query_hosts(self, *args):  # pylint: disable=unused-argument
42          return dict(data=pc.query_host_cache())
43  
44      @expose('json')
45 @@ -197,7 +197,7 @@ class PatchAPIController(object):
46  
47      @expose('json')
48      @expose('query.xml', content_type='application/xml')
49 -    def host_install(self, *args):
50 +    def host_install(self, *args):  # pylint: disable=unused-argument
51          return dict(error="Deprecated: Use host_install_async")
52  
53      @expose('json')
54 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/messages.py b/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
55 index a57ea28..6abc29d 100644
56 --- a/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
57 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
58 @@ -60,5 +60,5 @@ class PatchMessage(object):
59              return PATCHMSG_STR[self.msgtype]
60          return "invalid-type"
61  
62 -    def handle(self, sock, addr):
63 +    def handle(self, sock, addr):  # pylint: disable=unused-argument
64          LOG.info("Unhandled message type: %s" % self.msgtype)
65 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
66 index 77930d7..547db52 100644
67 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
68 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
69 @@ -150,7 +150,7 @@ class PatchMessageHelloAgent(messages.PatchMessage):
70          resp = PatchMessageHelloAgentAck()
71          resp.send(sock)
72  
73 -    def send(self, sock):
74 +    def send(self, sock):  # pylint: disable=unused-argument
75          LOG.error("Should not get here")
76  
77  
78 @@ -196,7 +196,7 @@ class PatchMessageQueryDetailed(messages.PatchMessage):
79          resp = PatchMessageQueryDetailedResp()
80          resp.send(sock)
81  
82 -    def send(self, sock):
83 +    def send(self, sock):  # pylint: disable=unused-argument
84          LOG.error("Should not get here")
85  
86  
87 @@ -258,7 +258,7 @@ class PatchMessageAgentInstallReq(messages.PatchMessage):
88          resp.status = pa.handle_install()
89          resp.send(sock, addr)
90  
91 -    def send(self, sock):
92 +    def send(self, sock):  # pylint: disable=unused-argument
93          LOG.error("Should not get here")
94  
95  
96 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py
97 index 705590c..af189fc 100644
98 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py
99 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_client.py
100 @@ -960,7 +960,7 @@ def wait_for_install_complete(agent_ip):
101      return rc
102  
103  
104 -def host_install(debug, args):
105 +def host_install(debug, args):  # pylint: disable=unused-argument
106      force = False
107      rc = 0
108  
109 @@ -1072,7 +1072,7 @@ def patch_upload_dir_req(debug, args):
110      return check_rc(req)
111  
112  
113 -def patch_install_local(debug, args):
114 +def patch_install_local(debug, args):  # pylint: disable=unused-argument
115      """ This function is used to trigger patch installation prior to configuration """
116      # Check to see if initial configuration has completed
117      if os.path.isfile(INITIAL_CONTROLLER_CONFIG_COMPLETE):
118 @@ -1214,7 +1214,7 @@ def patch_is_available_req(args):
119      return rc
120  
121  
122 -def patch_report_app_dependencies_req(debug, args):
123 +def patch_report_app_dependencies_req(debug, args):  # pylint: disable=unused-argument
124      if len(args) < 2:
125          print_help()
126  
127 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
128 index 4b94a5f..79a6401 100644
129 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
130 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
131 @@ -392,7 +392,7 @@ class PatchMessageHelloAgentAck(messages.PatchMessage):
132                                   self.agent_state)
133          pc.hosts_lock.release()
134  
135 -    def send(self, sock):
136 +    def send(self, sock):  # pylint: disable=unused-argument
137          LOG.error("Should not get here")
138  
139  
140 @@ -469,7 +469,7 @@ class PatchMessageQueryDetailedResp(messages.PatchMessage):
141          else:
142              pc.hosts_lock.release()
143  
144 -    def send(self, sock):
145 +    def send(self, sock):  # pylint: disable=unused-argument
146          LOG.error("Should not get here")
147  
148  
149 @@ -525,7 +525,7 @@ class PatchMessageAgentInstallResp(messages.PatchMessage):
150          pc.hosts[addr[0]].install_reject_reason = self.reject_reason
151          pc.hosts_lock.release()
152  
153 -    def send(self, sock):
154 +    def send(self, sock):  # pylint: disable=unused-argument
155          LOG.error("Should not get here")
156  
157  
158 @@ -2298,6 +2298,8 @@ class PatchController(PatchService):
159          finally:
160              self.patch_data_lock.release()
161  
162 +        return True
163 +
164      def query_app_dependencies(self):
165          """
166          Query application dependencies
167 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py
168 index 281a286..e9017f2 100644
169 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py
170 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_functions.py
171 @@ -1253,7 +1253,7 @@ class PatchFile(object):
172              msg = "Failed during patch extraction"
173              LOG.exception(msg)
174              raise PatchFail(msg)
175 -        except IOError:
176 +        except IOError:  # pylint: disable=duplicate-except
177              msg = "Failed during patch extraction"
178              LOG.exception(msg)
179              raise PatchFail(msg)
180 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/tests/test_patch_controller.py b/cgcs-patch/cgcs-patch/cgcs_patch/tests/test_patch_controller.py
181 index e2b02c0..1db4b68 100644
182 --- a/cgcs-patch/cgcs-patch/cgcs_patch/tests/test_patch_controller.py
183 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/tests/test_patch_controller.py
184 @@ -17,6 +17,6 @@ import cgcs_patch.patch_controller  # noqa: E402
185  class CgcsPatchControllerTestCase(testtools.TestCase):
186  
187      @mock.patch('six.moves.builtins.open')
188 -    def test_cgcs_patch_controller_instantiate(self, mock_open):
189 +    def test_cgcs_patch_controller_instantiate(self, mock_open):  # pylint: disable=unused-argument
190          # pylint: disable=unused-variable
191          pc = cgcs_patch.patch_controller.PatchController()  # noqa: F841
192 diff --git a/cgcs-patch/cgcs-patch/pylint.rc b/cgcs-patch/cgcs-patch/pylint.rc
193 index 812b6b5..a2d888b 100644
194 --- a/cgcs-patch/cgcs-patch/pylint.rc
195 +++ b/cgcs-patch/cgcs-patch/pylint.rc
196 @@ -44,16 +44,12 @@ symbols=no
197  # --enable=similarities". If you want to run only the classes checker, but have
198  # no Warning level messages displayed, use"--disable=all --enable=classes
199  # --disable=W"
200 -# E1111 assignment-from-no-return
201  # W0107 unnecessary-pass
202  # W0603 global-statement
203 -# W0612 unused-variable
204 -# W0613 unused-argument
205  # W0703 broad-except
206 -# W0705 duplicate-except
207  # W1201 logging-not-lazy
208  # W1505, deprecated-method
209 -disable=C, R, E1111, W0107, W0603, W0612, W0613, W0703, W0705, W1201, W1505
210 +disable=C, R, W0107, W0603, W0703, W1201, W1505
211  
212  
213  [REPORTS]