summaryrefslogtreecommitdiff
path: root/ec2init/DataSource.py
blob: 23e585e275de4bc6ae9391c5481575e844a3ff26 (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
27
28
29

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

    def get_user_data_raw(self):
        return(self.userdata_raw)