Skip to content

Commit

Permalink
fix: cleanup detection of etcd version
Browse files Browse the repository at this point in the history
  • Loading branch information
linki committed Mar 1, 2018
1 parent 7ab8bde commit 252b986
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,12 @@ def etcd_arguments(self, data_dir, initial_cluster, cluster_state):
etcdversion = os.environ.get('ETCDVERSION')
if etcdversion:
etcdversion = list(map(lambda x: int(x), etcdversion.split('.')))
# don't try to add additonal flags if we encounter an unexpected version format
if len(etcdversion) == 3:
# etcd >= v3.3: serve metrics on an additonal port
if etcdversion[0] >= 3 and etcdversion[1] >= 3:
arguments += [
'-listen-metrics-urls',
'http://0.0.0.0:{}'.format(self.metrics_port),
]
# etcd >= v3.3: serve metrics on an additonal port
if etcdversion >= [3, 3]:
arguments += [
'-listen-metrics-urls',
'http://0.0.0.0:{}'.format(self.metrics_port),
]

# return final list of arguments
return arguments
Expand Down

0 comments on commit 252b986

Please sign in to comment.