Revision cf4f52b6 image_creator/kamaki_wrapper.py

b/image_creator/kamaki_wrapper.py
44 44

  
45 45

  
46 46
class Kamaki(object):
47

  
48
    @staticmethod
49
    def saved_credentials():
50
        config = Config()
51
        account = config.get('storage', 'account')
52
        token = config.get('global', 'token')
53

  
54
        return (account, token)
55

  
56
    @staticmethod
57
    def save_account(account):
58
        config = Config()
59
        config.set('storage', 'account', account)
60
        config.write()
61

  
62
    @staticmethod
63
    def save_token(token):
64
        config = Config()
65
        config.set('global', 'token', token)
66
        config.write()
67

  
47 68
    def __init__(self, account, token, output):
48 69
        self.account = account
49 70
        self.token = token
......
53 74

  
54 75
        pithos_url = config.get('storage', 'url')
55 76
        self.container = CONTAINER
56
        self.pithos_client = PithosClient(pithos_url, token, self.account,
77
        self.pithos_client = PithosClient(pithos_url, self.token, self.account,
57 78
                                          self.container)
58 79

  
59 80
        image_url = config.get('image', 'url')
60
        self.image_client = ImageClient(image_url, token)
61

  
62
        self.uploaded_object = None
81
        self.image_client = ImageClient(image_url, self.token)
63 82

  
64 83
    def upload(self, file_obj, size=None, remote_path=None, hp=None, up=None):
65 84
        """Upload a file to pithos"""

Also available in: Unified diff