Revision 3185cd6d kamaki/cli/commands/astakos.py

b/kamaki/cli/commands/astakos.py
87 87
    (In case of another named cloud, use its name instead of default)
88 88
    """
89 89

  
90
    @staticmethod
91
    def _print_access(r, out=stdout):
92
        print_dict(r['access'], out=out)
93

  
94 90
    @errors.generic.all
95 91
    @errors.user.authenticate
96 92
    def _run(self, custom_token=None):
......
105 101
            #recover old token
106 102
            self.client.token = token_bu
107 103
            raise
108
        self._print(r, self._print_access)
104

  
105
        def _print_access(r, out):
106
            print_dict(r['access'], out=out)
107

  
108
        self._print(r, _print_access)
109 109

  
110 110
    def main(self, custom_token=None):
111 111
        super(self.__class__, self)._run()
......
155 155
            if user.get('id', None) in (uuid,):
156 156
                ntoken = user['auth_token']
157 157
                if ntoken == self.client.token:
158
                    print('%s (%s) is already the session user' % (
158
                    self.error('%s (%s) is already the session user' % (
159 159
                        self.client.user_term('name'),
160 160
                        self.client.user_term('id')))
161 161
                    return
162 162
                self.client.token = user['auth_token']
163
                print('Session user set to %s (%s)' % (
163
                self.error('Session user set to %s (%s)' % (
164 164
                        self.client.user_term('name'),
165 165
                        self.client.user_term('id')))
166
                if ask_user('Permanently make %s the main user?' % (
167
                        self.client.user_term('name'))):
166
                if ask_user(
167
                        'Permanently make %s the main user?' % (
168
                            self.client.user_term('name')),
169
                        out=self._out, user_in=self._in):
168 170
                    self._write_main_token(self.client.token)
169 171
                return
170 172
        raise CLIError(

Also available in: Unified diff