File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,23 +122,13 @@ def try_acquire_or_renew(self):
122122
123123 # A lock is not created with that name, try to create one
124124 if not lock_status :
125- # To be removed when support for python2 will be removed
126- if sys .version_info > (3 , 0 ):
127- if json .loads (old_election_record .body )[
128- 'code' ] != HTTPStatus .NOT_FOUND :
129- logger .info (
130- "Error retrieving resource lock {} as {}" .format (
131- self .election_config .lock .name ,
132- old_election_record .reason ))
133- return False
134- else :
135- if json .loads (old_election_record .body )[
136- 'code' ] != HTTPStatus .NOT_FOUND :
137- logger .info (
138- "Error retrieving resource lock {} as {}" .format (
139- self .election_config .lock .name ,
140- old_election_record .reason ))
141- return False
125+ if json .loads (old_election_record .body )[
126+ 'code' ] != HTTPStatus .NOT_FOUND :
127+ logger .info (
128+ "Error retrieving resource lock {} as {}" .format (
129+ self .election_config .lock .name ,
130+ old_election_record .reason ))
131+ return False
142132
143133 logger .info (
144134 "{} is trying to create a lock" .format (
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import http
1516import json
1617import pydoc
17- import sys
1818
1919from kubernetes import client
2020
2828# provide return_type to Watch class's __init__.
2929TYPE_LIST_SUFFIX = "List"
3030
31-
32- PY2 = sys .version_info [0 ] == 2
33- if PY2 :
34- import httplib
35- HTTP_STATUS_GONE = httplib .GONE
36- else :
37- import http
38- HTTP_STATUS_GONE = http .HTTPStatus .GONE
31+ HTTP_STATUS_GONE = http .HTTPStatus .GONE
3932
4033
4134class SimpleNamespace :
You can’t perform that action at this time.
0 commit comments