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 0a91415
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,13 @@ def etcd_arguments(self, data_dir, initial_cluster, cluster_state):
# this section handles etcd version specific flags
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),
]
etcdversion = tuple(int(x) for x in etcdversion.split('.'))
# 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 0a91415

Please sign in to comment.