summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-03-16 11:25:52 -0400
committerScott Moser <smoser@ubuntu.com>2012-03-16 11:25:52 -0400
commit3522b7b49368f486f61c220151212f68e9cc9782 (patch)
tree81ef85ba746b14011143bec150ebcca47b563614
parentaa9b2a86599905bf95b56627b0ce4bd96a1d7164 (diff)
downloadvyos-cloud-init-3522b7b49368f486f61c220151212f68e9cc9782.tar.gz
vyos-cloud-init-3522b7b49368f486f61c220151212f68e9cc9782.zip
rename DataSourceMaaS to DataSourceMAAS, generally use MAAS everywhere
instead of MaaS or Maas, use MAAS consistently. The only non 'MAAS' left are all lower case.
-rw-r--r--cloudinit/DataSourceMAAS.py (renamed from cloudinit/DataSourceMaaS.py)28
-rw-r--r--cloudinit/__init__.py2
-rw-r--r--config/cloud.cfg2
-rw-r--r--doc/examples/cloud-config-datasources.txt2
-rw-r--r--tests/unittests/test_datasource/test_maas.py30
5 files changed, 32 insertions, 32 deletions
diff --git a/cloudinit/DataSourceMaaS.py b/cloudinit/DataSourceMAAS.py
index ea42c1fb..80d3fd6e 100644
--- a/cloudinit/DataSourceMaaS.py
+++ b/cloudinit/DataSourceMAAS.py
@@ -31,9 +31,9 @@ import time
MD_VERSION = "2012-03-01"
-class DataSourceMaaS(DataSource.DataSource):
+class DataSourceMAAS(DataSource.DataSource):
"""
- DataSourceMaaS reads instance information from MaaS.
+ DataSourceMAAS reads instance information from MAAS.
Given a config metadata_url, and oauth tokens, it expects to find
files under the root named:
instance-id
@@ -44,7 +44,7 @@ class DataSourceMaaS(DataSource.DataSource):
baseurl = None
def __str__(self):
- return("DataSourceMaaS[%s]" % self.baseurl)
+ return("DataSourceMAAS[%s]" % self.baseurl)
def get_data(self):
mcfg = self.ds_cfg
@@ -55,9 +55,9 @@ class DataSourceMaaS(DataSource.DataSource):
self.metadata = metadata
self.baseurl = self.seeddir
return True
- except MaasSeedDirNone:
+ except MAASSeedDirNone:
pass
- except MaasSeedDirMalformed as exc:
+ except MAASSeedDirMalformed as exc:
log.warn("%s was malformed: %s\n" % (self.seeddir, exc))
raise
@@ -143,7 +143,7 @@ def read_maas_seed_dir(seed_d):
md = {}
if not os.path.isdir(seed_d):
- raise MaasSeedDirNone("%s: not a directory")
+ raise MAASSeedDirNone("%s: not a directory")
for fname in files:
try:
@@ -195,17 +195,17 @@ def check_seed_contents(content, seed):
"""Validate if content is Is the content a dict that is valid as a
return for a datasource.
Either return a (userdata, metadata) tuple or
- Raise MaasSeedDirMalformed or MaasSeedDirNone
+ Raise MAASSeedDirMalformed or MAASSeedDirNone
"""
md_required = ('instance-id', 'local-hostname')
found = content.keys()
if len(content) == 0:
- raise MaasSeedDirNone("%s: no data files found" % seed)
+ raise MAASSeedDirNone("%s: no data files found" % seed)
missing = [k for k in md_required if k not in found]
if len(missing):
- raise MaasSeedDirMalformed("%s: missing files %s" % (seed, missing))
+ raise MAASSeedDirMalformed("%s: missing files %s" % (seed, missing))
userdata = content.get('user-data', "")
md = {}
@@ -233,16 +233,16 @@ def oauth_headers(url, consumer_key, token_key, token_secret, consumer_secret):
return(req.to_header())
-class MaasSeedDirNone(Exception):
+class MAASSeedDirNone(Exception):
pass
-class MaasSeedDirMalformed(Exception):
+class MAASSeedDirMalformed(Exception):
pass
datasources = [
- (DataSourceMaaS, (DataSource.DEP_FILESYSTEM, DataSource.DEP_NETWORK)),
+ (DataSourceMAAS, (DataSource.DEP_FILESYSTEM, DataSource.DEP_NETWORK)),
]
@@ -261,7 +261,7 @@ if __name__ == "__main__":
import argparse
import pprint
- parser = argparse.ArgumentParser(description='Interact with Maas DS')
+ parser = argparse.ArgumentParser(description='Interact with MAAS DS')
parser.add_argument("--config", metavar="file",
help="specify DS config file", default=None)
parser.add_argument("--ckey", metavar="key",
@@ -292,7 +292,7 @@ if __name__ == "__main__":
with open(args.config) as fp:
cfg = yaml.load(fp)
if 'datasource' in cfg:
- cfg = cfg['datasource']['MaaS']
+ cfg = cfg['datasource']['MAAS']
for key in creds.keys():
if key in cfg and creds[key] == None:
creds[key] = cfg[key]
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py
index 3168a632..6d276d84 100644
--- a/cloudinit/__init__.py
+++ b/cloudinit/__init__.py
@@ -29,7 +29,7 @@ cfg_env_name = "CLOUD_CFG"
cfg_builtin = """
log_cfgs: []
-datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MaaS", "Ec2", "CloudStack"]
+datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MAAS", "Ec2", "CloudStack"]
def_log_file: /var/log/cloud-init.log
syslog_fix_perms: syslog:adm
"""
diff --git a/config/cloud.cfg b/config/cloud.cfg
index 983b0ba6..3688f88d 100644
--- a/config/cloud.cfg
+++ b/config/cloud.cfg
@@ -1,7 +1,7 @@
user: ubuntu
disable_root: 1
preserve_hostname: False
-# datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MaaS", "Ec2", "CloudStack"]
+# datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MAAS", "Ec2", "CloudStack"]
cloud_init_modules:
- bootcmd
diff --git a/doc/examples/cloud-config-datasources.txt b/doc/examples/cloud-config-datasources.txt
index b3a26114..63a6cfc4 100644
--- a/doc/examples/cloud-config-datasources.txt
+++ b/doc/examples/cloud-config-datasources.txt
@@ -14,7 +14,7 @@ datasource:
- http://169.254.169.254:80
- http://instance-data:8773
- MaaS:
+ MAAS:
timeout : 50
max_wait : 120
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index d0e121d6..01565217 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -3,24 +3,24 @@ from shutil import rmtree
import os
from StringIO import StringIO
from copy import copy
-from cloudinit.DataSourceMaaS import (
- MaasSeedDirNone,
- MaasSeedDirMalformed,
+from cloudinit.DataSourceMAAS import (
+ MAASSeedDirNone,
+ MAASSeedDirMalformed,
read_maas_seed_dir,
read_maas_seed_url,
)
from mocker import MockerTestCase
-class TestMaasDataSource(MockerTestCase):
+class TestMAASDataSource(MockerTestCase):
def setUp(self):
- super(TestMaasDataSource, self).setUp()
+ super(TestMAASDataSource, self).setUp()
# Make a temp directoy for tests to use.
self.tmp = mkdtemp(prefix="unittest_")
def tearDown(self):
- super(TestMaasDataSource, self).tearDown()
+ super(TestMAASDataSource, self).tearDown()
# Clean up temp directory
rmtree(self.tmp)
@@ -63,7 +63,7 @@ class TestMaasDataSource(MockerTestCase):
self.assertFalse(('foo' in metadata))
def test_seed_dir_invalid(self):
- """Verify that invalid seed_dir raises MaasSeedDirMalformed"""
+ """Verify that invalid seed_dir raises MAASSeedDirMalformed"""
valid = {'instance-id': 'i-instanceid',
'local-hostname': 'test-hostname', 'user-data': ''}
@@ -75,24 +75,24 @@ class TestMaasDataSource(MockerTestCase):
invalid_data = copy(valid)
del invalid_data['local-hostname']
populate_dir(my_d, invalid_data)
- self.assertRaises(MaasSeedDirMalformed, read_maas_seed_dir, my_d)
+ self.assertRaises(MAASSeedDirMalformed, read_maas_seed_dir, my_d)
# missing 'instance-id'
my_d = "%s-02" % my_based
invalid_data = copy(valid)
del invalid_data['instance-id']
populate_dir(my_d, invalid_data)
- self.assertRaises(MaasSeedDirMalformed, read_maas_seed_dir, my_d)
+ self.assertRaises(MAASSeedDirMalformed, read_maas_seed_dir, my_d)
def test_seed_dir_none(self):
- """Verify that empty seed_dir raises MaasSeedDirNone"""
+ """Verify that empty seed_dir raises MAASSeedDirNone"""
my_d = os.path.join(self.tmp, "valid_empty")
- self.assertRaises(MaasSeedDirNone, read_maas_seed_dir, my_d)
+ self.assertRaises(MAASSeedDirNone, read_maas_seed_dir, my_d)
def test_seed_dir_missing(self):
- """Verify that missing seed_dir raises MaasSeedDirNone"""
- self.assertRaises(MaasSeedDirNone, read_maas_seed_dir,
+ """Verify that missing seed_dir raises MAASSeedDirNone"""
+ self.assertRaises(MAASSeedDirNone, read_maas_seed_dir,
os.path.join(self.tmp, "nonexistantdirectory"))
def test_seed_url_valid(self):
@@ -133,11 +133,11 @@ class TestMaasDataSource(MockerTestCase):
valid['meta-data/local-hostname'])
def test_seed_url_invalid(self):
- """Verify that invalid seed_url raises MaasSeedDirMalformed"""
+ """Verify that invalid seed_url raises MAASSeedDirMalformed"""
pass
def test_seed_url_missing(self):
- """Verify seed_url with no found entries raises MaasSeedDirNone"""
+ """Verify seed_url with no found entries raises MAASSeedDirNone"""
pass