Commits

Anonymous committed bff31a0

handle user data that begins with data rather than sections
import errors and constants into module scope

  • Participants
  • Parent commits ffc801f

Comments (0)

Files changed (2)

File amiconfig/__init__.py

 # Copyright (c) 2007 rPath, Inc.
 #
 
+from constants import *
 from amiconfig import AMIConfig
+from errors import EC2DataRetrievalError

File amiconfig/userdata.py

 from errors import *
 
 class INIFileStub:
-    def __init__(self, contents):
+    def __init__(self, contents, name=None):
         self.__contents = contents.split('\n')
         self.__pos = 0
         self.__sectre = RawConfigParser.SECTCRE
         self.__optre = RawConfigParser.OPTCRE
-        self.name = ':memory:'
+        if name:
+            self.name = name
+        else:
+            self.name = ':memory:'
 
     def sanitize(self):
         list = []
             userData = id.getUserData()
         except EC2DataRetrievalError:
             userData = ''
-        self.fd = INIFileStub(userData)
+        self.fd = INIFileStub(userData, name='EC2UserData')
         self.fd.sanitize()
         self.readfp(self.fd)