summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorNeal Shrader <neal@digitalocean.com>2014-10-16 18:20:19 -0400
committerNeal Shrader <neal@digitalocean.com>2014-10-16 18:20:19 -0400
commit33b54a3ac2560b192f29ce1fbe797fdd3cb968aa (patch)
treebd7a22a40902cc409dcfeceb08c8c0b3148a5e80 /cloudinit
parent4f24ed06e2ebfa59349fa8652b59f7743a78e79b (diff)
downloadvyos-cloud-init-33b54a3ac2560b192f29ce1fbe797fdd3cb968aa.tar.gz
vyos-cloud-init-33b54a3ac2560b192f29ce1fbe797fdd3cb968aa.zip
Make metadata timeout/retries configurable
Defaulting to only trying once.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/sources/DataSourceDigitalOcean.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceDigitalOcean.py b/cloudinit/sources/DataSourceDigitalOcean.py
index c580e2d5..985f1663 100644
--- a/cloudinit/sources/DataSourceDigitalOcean.py
+++ b/cloudinit/sources/DataSourceDigitalOcean.py
@@ -25,6 +25,8 @@ BUILTIN_DS_CONFIG = {
'metadata_url': 'http://169.254.169.254/metadata/v1',
'mirrors_url': 'http://mirrors.digitalocean.com/'
}
+MD_RETRIES = 0
+MD_TIMEOUT = 1
class DataSourceDigitalOcean(sources.DataSource):
def __init__(self, sys_cfg, distro, paths):
@@ -34,8 +36,16 @@ class DataSourceDigitalOcean(sources.DataSource):
util.get_cfg_by_path(sys_cfg, ["datasource", "DigitalOcean"], {}),
BUILTIN_DS_CONFIG])
self.metadata_address = self.ds_cfg['metadata_url']
- self.retries = 3
- self.timeout = 1
+
+ if self.ds_cfg.get('retries'):
+ self.retries = self.ds_cfg['retries']
+ else:
+ self.retries = MD_RETRIES
+
+ if self.ds_cfg.get('timeout'):
+ self.timeout = self.ds_cfg['timeout']
+ else:
+ self.timeout = MD_TIMEOUT
def get_data(self):
url_map = [