summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-10-19 14:06:21 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-10-19 14:06:21 -0700
commit7c9bbbc9b49425e3ba8e0517908477c58ea51d4b (patch)
tree1c21d521b299f5ac29a5f83855cb976eba44ed0e /cloudinit/sources
parent914c6e86f1689ae186a0db836e7f0304d72c38b4 (diff)
downloadvyos-cloud-init-7c9bbbc9b49425e3ba8e0517908477c58ea51d4b.tar.gz
vyos-cloud-init-7c9bbbc9b49425e3ba8e0517908477c58ea51d4b.zip
Remove the need for boto just for fetching the
userdata and metadata. Add in this crawling functionality to the ec2_utils module that will fully crawl (not lazily) the ec2 metadata and parse it in the same manner as boto. 1. Make the ec2 datasource + cloudstack now call into these. 2. Fix phone_home due to urllib3 change (TBD)
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py9
-rw-r--r--cloudinit/sources/DataSourceEc2.py9
2 files changed, 6 insertions, 12 deletions
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index f7ffa7cb..2654df53 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -26,8 +26,7 @@ from struct import pack
import os
import time
-import boto.utils as boto_utils
-
+from cloudinit import ec2_utils
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import url_helper as uhelp
@@ -116,10 +115,8 @@ class DataSourceCloudStack(sources.DataSource):
if not self.wait_for_metadata_service():
return False
start_time = time.time()
- self.userdata_raw = boto_utils.get_instance_userdata(self.api_ver,
- None, self.metadata_address)
- self.metadata = boto_utils.get_instance_metadata(self.api_ver,
- self.metadata_address)
+ self.userdata_raw = ec2_utils.get_instance_userdata(self.metadata_address, self.api_ver)
+ self.metadata = ec2_utils.get_instance_metadata(self.metadata_address, self.api_ver)
LOG.debug("Crawl of metadata service took %s seconds",
int(time.time() - start_time))
return True
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 3686fa10..204963e7 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -23,8 +23,7 @@
import os
import time
-import boto.utils as boto_utils
-
+from cloudinit import ec2_utils
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import url_helper as uhelp
@@ -65,10 +64,8 @@ class DataSourceEc2(sources.DataSource):
if not self.wait_for_metadata_service():
return False
start_time = time.time()
- self.userdata_raw = boto_utils.get_instance_userdata(self.api_ver,
- None, self.metadata_address)
- self.metadata = boto_utils.get_instance_metadata(self.api_ver,
- self.metadata_address)
+ self.userdata_raw = ec2_utils.get_instance_userdata(self.metadata_address, self.api_ver)
+ self.metadata = ec2_utils.get_instance_metadata(self.metadata_address, self.api_ver)
LOG.debug("Crawl of metadata service took %s seconds",
int(time.time() - start_time))
return True