Example #1
0
    def to_mime_text(self):
        # These hard coded strings are to avoid having diffs in userdata
        # when nothing changed. Without this AWS sees the userdata has changed
        # (the MIME boundary or "unixfrom" changed) and it relaunches the
        # instance to give it new data.
        container = MIMEMultipart(boundary='--===============HI-20131203==--')
        container._unixfrom = 'From nobody Tue Dec  3 19:00:57 2013'
        for part in self.parts:
            _new_mime_part(container, part[0], part[1])

        if self.files_config:
            for (content_type, files) in self.files_config.iteritems():
                _new_mime_part(container, content_type, yaml.safe_dump(files))

        return str(container)
Example #2
0
    def to_mime_text(self):
        # These hard coded strings are to avoid having diffs in userdata
        # when nothing changed. Without this AWS sees the userdata has changed
        # (the MIME boundary or "unixfrom" changed) and it relaunches the
        # instance to give it new data.
        container = MIMEMultipart(boundary='--===============HI-20131203==--')
        container._unixfrom = 'From nobody Tue Dec  3 19:00:57 2013'
        for part in self.parts:
            _new_mime_part(container, part[0], part[1])

        if self.files_config:
            for (content_type, files) in self.files_config.iteritems():
                _new_mime_part(container, content_type, yaml.safe_dump(files))

        return str(container)