summaryrefslogtreecommitdiff
path: root/ec2init/DataSource.py
blob: b940c564f88d8e5750032e986c4f6a640f61756d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import ec2init

class DataSource:
    userdata = None
    metadata = None
    userdata_raw = None

    def __init__(self):
       pass

    def store_user_data_raw(self):
        fp=fopen(user_data_raw,"wb")
        fp.write(self.userdata_raw)
        fp.close()
    
    def store_user_data(self):
        fp=fopen(user_data,"wb")
        fp.write(self.userdata)
        fp.close()

    def get_user_data(self):
        if self.userdata == None:
            self.userdata = ec2init.preprocess_user_data(self.userdata_raw)

        return self.userdata