summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@nelson>2010-01-07 21:29:27 -0500
committerScott Moser <smoser@nelson>2010-01-07 21:29:27 -0500
commit938ba376f2c7551a471991b4046e11a4f92f30d5 (patch)
tree9f0e1e6d853d5750fd1d2e7d4a79672767ae83a4
parent495b58abad330d5511c1f80b07088c53461579c6 (diff)
downloadvyos-cloud-init-938ba376f2c7551a471991b4046e11a4f92f30d5.tar.gz
vyos-cloud-init-938ba376f2c7551a471991b4046e11a4f92f30d5.zip
support setting hostname
-rwxr-xr-xec2-init.py2
-rw-r--r--ec2init/__init__.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/ec2-init.py b/ec2-init.py
index 6944ff54..45932fa7 100755
--- a/ec2-init.py
+++ b/ec2-init.py
@@ -20,6 +20,8 @@ def main():
sys.stderr.write("Failed to get instance data")
sys.exit(1)
+ hostname = cloud.get_hostname()
+ subprocess.Popen(['hostname', hostname]).communicate()
#print "user data is:" + cloud.get_user_data()
# store the metadata
diff --git a/ec2init/__init__.py b/ec2init/__init__.py
index 7a9c8a95..270414f7 100644
--- a/ec2init/__init__.py
+++ b/ec2init/__init__.py
@@ -236,6 +236,9 @@ class EC2Init:
def get_mirror(self):
return(self.datasource.get_local_mirror())
+ def get_hostname(self):
+ return(self.datasource.get_hostname())
+
def apply_credentials(self):
user = self.get_cfg_option_str('user')
disable_root = self.get_cfg_option_bool('disable_root', True)