root / kamaki / cli / commands / astakos.py @ aef3fa1f
History | View | Annotate | Download (28.8 kB)
1 | e3f01d64 | Stavros Sachtouris | # Copyright 2011-2013 GRNET S.A. All rights reserved.
|
---|---|---|---|
2 | 7493ccb6 | Stavros Sachtouris | #
|
3 | 7493ccb6 | Stavros Sachtouris | # Redistribution and use in source and binary forms, with or
|
4 | 7493ccb6 | Stavros Sachtouris | # without modification, are permitted provided that the following
|
5 | 7493ccb6 | Stavros Sachtouris | # conditions are met:
|
6 | 7493ccb6 | Stavros Sachtouris | #
|
7 | 7493ccb6 | Stavros Sachtouris | # 1. Redistributions of source code must retain the above
|
8 | 7493ccb6 | Stavros Sachtouris | # copyright notice, this list of conditions and the following
|
9 | 7493ccb6 | Stavros Sachtouris | # disclaimer.
|
10 | 7493ccb6 | Stavros Sachtouris | #
|
11 | 7493ccb6 | Stavros Sachtouris | # 2. Redistributions in binary form must reproduce the above
|
12 | 7493ccb6 | Stavros Sachtouris | # copyright notice, this list of conditions and the following
|
13 | 7493ccb6 | Stavros Sachtouris | # disclaimer in the documentation and/or other materials
|
14 | 7493ccb6 | Stavros Sachtouris | # provided with the distribution.
|
15 | 7493ccb6 | Stavros Sachtouris | #
|
16 | 7493ccb6 | Stavros Sachtouris | # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
17 | 7493ccb6 | Stavros Sachtouris | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 | 7493ccb6 | Stavros Sachtouris | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19 | 7493ccb6 | Stavros Sachtouris | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
20 | 7493ccb6 | Stavros Sachtouris | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 | 7493ccb6 | Stavros Sachtouris | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 | 7493ccb6 | Stavros Sachtouris | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
23 | 7493ccb6 | Stavros Sachtouris | # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
24 | 7493ccb6 | Stavros Sachtouris | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
25 | 7493ccb6 | Stavros Sachtouris | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
26 | 7493ccb6 | Stavros Sachtouris | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 | 7493ccb6 | Stavros Sachtouris | # POSSIBILITY OF SUCH DAMAGE.
|
28 | 7493ccb6 | Stavros Sachtouris | #
|
29 | 7493ccb6 | Stavros Sachtouris | # The views and conclusions contained in the software and
|
30 | 7493ccb6 | Stavros Sachtouris | # documentation are those of the authors and should not be
|
31 | 7493ccb6 | Stavros Sachtouris | # interpreted as representing official policies, either expressed
|
32 | 7493ccb6 | Stavros Sachtouris | # or implied, of GRNET S.A.command
|
33 | 7493ccb6 | Stavros Sachtouris | |
34 | ab863157 | Stavros Sachtouris | from json import load, loads |
35 | c308d73f | Stavros Sachtouris | from os.path import abspath |
36 | c308d73f | Stavros Sachtouris | |
37 | c2be5c96 | Stavros Sachtouris | from kamaki.cli import command |
38 | 5033585e | Stavros Sachtouris | from kamaki.clients.astakos import SynnefoAstakosClient |
39 | b4f69041 | Stavros Sachtouris | from kamaki.cli.commands import ( |
40 | 98c02f22 | Stavros Sachtouris | _command_init, errors, _optional_json, addLogSettings) |
41 | be99b6ad | Stavros Sachtouris | from kamaki.cli.command_tree import CommandTree |
42 | fa7d08b6 | Stavros Sachtouris | from kamaki.cli.errors import CLIBaseUrlError, CLISyntaxError, CLIError |
43 | ab863157 | Stavros Sachtouris | from kamaki.cli.argument import ( |
44 | ab863157 | Stavros Sachtouris | FlagArgument, ValueArgument, IntArgument, CommaSeparatedListArgument) |
45 | e8d3b957 | Stavros Sachtouris | from kamaki.cli.utils import format_size |
46 | 7493ccb6 | Stavros Sachtouris | |
47 | e8d3b957 | Stavros Sachtouris | user_commands = CommandTree('user', 'Astakos/Identity API commands') |
48 | e8d3b957 | Stavros Sachtouris | admin_commands = CommandTree('admin', 'Astakos/Account API commands') |
49 | e8d3b957 | Stavros Sachtouris | project_commands = CommandTree('project', 'Astakos project API commands') |
50 | e8d3b957 | Stavros Sachtouris | _commands = [user_commands, admin_commands, project_commands] |
51 | 234954d1 | Stavros Sachtouris | |
52 | 234954d1 | Stavros Sachtouris | |
53 | ab863157 | Stavros Sachtouris | def with_temp_token(foo): |
54 | ab863157 | Stavros Sachtouris | """ Set token to self.client.token, run foo, recover old token """
|
55 | ab863157 | Stavros Sachtouris | def wrap(self, *args, **kwargs): |
56 | ab863157 | Stavros Sachtouris | try:
|
57 | ab863157 | Stavros Sachtouris | token = kwargs.pop('token')
|
58 | ab863157 | Stavros Sachtouris | except KeyError: |
59 | ab863157 | Stavros Sachtouris | raise CLISyntaxError('A token is needed for %s' % foo) |
60 | ab863157 | Stavros Sachtouris | token_bu = self.client.token
|
61 | ab863157 | Stavros Sachtouris | try:
|
62 | fa7d08b6 | Stavros Sachtouris | self.client.token = token or token_bu |
63 | ab863157 | Stavros Sachtouris | return foo(self, *args, **kwargs) |
64 | ab863157 | Stavros Sachtouris | finally:
|
65 | ab863157 | Stavros Sachtouris | self.client.token = token_bu
|
66 | ab863157 | Stavros Sachtouris | return wrap
|
67 | ab863157 | Stavros Sachtouris | |
68 | ab863157 | Stavros Sachtouris | |
69 | e8d3b957 | Stavros Sachtouris | class _init_synnefo_astakosclient(_command_init): |
70 | 85115c12 | Stavros Sachtouris | |
71 | a03ade9e | Stavros Sachtouris | @errors.generic.all
|
72 | 4018326d | Stavros Sachtouris | @errors.user.load
|
73 | e8d3b957 | Stavros Sachtouris | @errors.user.astakosclient
|
74 | b4f69041 | Stavros Sachtouris | @addLogSettings
|
75 | 436bd910 | Stavros Sachtouris | def _run(self): |
76 | e8d3b957 | Stavros Sachtouris | if getattr(self, 'cloud', None): |
77 | b4f69041 | Stavros Sachtouris | base_url = self._custom_url('astakos') |
78 | b4f69041 | Stavros Sachtouris | if base_url:
|
79 | f5ff79d9 | Stavros Sachtouris | token = self._custom_token(
|
80 | ab863157 | Stavros Sachtouris | 'astakos') or self.config.get_cloud( |
81 | ab863157 | Stavros Sachtouris | self.cloud, 'token') |
82 | dc897a7e | Stavros Sachtouris | token = token.split()[0] if ' ' in token else token |
83 | e8d3b957 | Stavros Sachtouris | self.client = SynnefoAstakosClient(
|
84 | e8d3b957 | Stavros Sachtouris | auth_url=base_url, token=token) |
85 | b4f69041 | Stavros Sachtouris | return
|
86 | b4f69041 | Stavros Sachtouris | else:
|
87 | b4f69041 | Stavros Sachtouris | self.cloud = 'default' |
88 | e8d3b957 | Stavros Sachtouris | if getattr(self, 'auth_base', None): |
89 | 5033585e | Stavros Sachtouris | self.client = self.auth_base.get_client() |
90 | b4f69041 | Stavros Sachtouris | return
|
91 | b4f69041 | Stavros Sachtouris | raise CLIBaseUrlError(service='astakos') |
92 | 7493ccb6 | Stavros Sachtouris | |
93 | 436bd910 | Stavros Sachtouris | def main(self): |
94 | 5fdccdec | Stavros Sachtouris | self._run()
|
95 | 436bd910 | Stavros Sachtouris | |
96 | 234954d1 | Stavros Sachtouris | |
97 | e8d3b957 | Stavros Sachtouris | @command(user_commands)
|
98 | fa7d08b6 | Stavros Sachtouris | class user_authenticate(_init_synnefo_astakosclient, _optional_json): |
99 | fa7d08b6 | Stavros Sachtouris | """Authenticate a user and get all authentication information"""
|
100 | 7493ccb6 | Stavros Sachtouris | |
101 | a03ade9e | Stavros Sachtouris | @errors.generic.all
|
102 | 4018326d | Stavros Sachtouris | @errors.user.authenticate
|
103 | e8d3b957 | Stavros Sachtouris | @errors.user.astakosclient
|
104 | 5033585e | Stavros Sachtouris | @with_temp_token
|
105 | 5033585e | Stavros Sachtouris | def _run(self): |
106 | fa7d08b6 | Stavros Sachtouris | self._print(self.client.authenticate(), self.print_dict) |
107 | 3185cd6d | Stavros Sachtouris | |
108 | e8d3b957 | Stavros Sachtouris | def main(self, token=None): |
109 | 9a8861d1 | Stavros Sachtouris | super(self.__class__, self)._run() |
110 | 5033585e | Stavros Sachtouris | self._run(token=token)
|
111 | 9a8861d1 | Stavros Sachtouris | |
112 | 9a8861d1 | Stavros Sachtouris | |
113 | e8d3b957 | Stavros Sachtouris | @command(user_commands)
|
114 | 5033585e | Stavros Sachtouris | class user_uuid2name(_init_synnefo_astakosclient, _optional_json): |
115 | 5033585e | Stavros Sachtouris | """Get user name(s) from uuid(s)"""
|
116 | 9a8861d1 | Stavros Sachtouris | |
117 | 9a8861d1 | Stavros Sachtouris | @errors.generic.all
|
118 | e8d3b957 | Stavros Sachtouris | @errors.user.astakosclient
|
119 | e8d3b957 | Stavros Sachtouris | def _run(self, uuids): |
120 | e8d3b957 | Stavros Sachtouris | r = self.client.get_usernames(uuids)
|
121 | e8d3b957 | Stavros Sachtouris | self._print(r, self.print_dict) |
122 | e8d3b957 | Stavros Sachtouris | unresolved = set(uuids).difference(r)
|
123 | e8d3b957 | Stavros Sachtouris | if unresolved:
|
124 | e8d3b957 | Stavros Sachtouris | self.error('Unresolved uuids: %s' % ', '.join(unresolved)) |
125 | e8d3b957 | Stavros Sachtouris | |
126 | e8d3b957 | Stavros Sachtouris | def main(self, uuid, *more_uuids): |
127 | 9a8861d1 | Stavros Sachtouris | super(self.__class__, self)._run() |
128 | e8d3b957 | Stavros Sachtouris | self._run(uuids=((uuid, ) + more_uuids))
|
129 | b91111b9 | Stavros Sachtouris | |
130 | b91111b9 | Stavros Sachtouris | |
131 | e8d3b957 | Stavros Sachtouris | @command(user_commands)
|
132 | 5033585e | Stavros Sachtouris | class user_name2uuid(_init_synnefo_astakosclient, _optional_json): |
133 | 5033585e | Stavros Sachtouris | """Get user uuid(s) from name(s)"""
|
134 | b91111b9 | Stavros Sachtouris | |
135 | b91111b9 | Stavros Sachtouris | @errors.generic.all
|
136 | e8d3b957 | Stavros Sachtouris | @errors.user.astakosclient
|
137 | e8d3b957 | Stavros Sachtouris | def _run(self, usernames): |
138 | e8d3b957 | Stavros Sachtouris | r = self.client.get_uuids(usernames)
|
139 | e8d3b957 | Stavros Sachtouris | self._print(r, self.print_dict) |
140 | e8d3b957 | Stavros Sachtouris | unresolved = set(usernames).difference(r)
|
141 | e8d3b957 | Stavros Sachtouris | if unresolved:
|
142 | e8d3b957 | Stavros Sachtouris | self.error('Unresolved usernames: %s' % ', '.join(unresolved)) |
143 | e8d3b957 | Stavros Sachtouris | |
144 | e8d3b957 | Stavros Sachtouris | def main(self, username, *more_usernames): |
145 | b91111b9 | Stavros Sachtouris | super(self.__class__, self)._run() |
146 | e8d3b957 | Stavros Sachtouris | self._run(usernames=((username, ) + more_usernames))
|
147 | e8d3b957 | Stavros Sachtouris | |
148 | e8d3b957 | Stavros Sachtouris | |
149 | e8d3b957 | Stavros Sachtouris | @command(user_commands)
|
150 | e8d3b957 | Stavros Sachtouris | class user_quotas(_init_synnefo_astakosclient, _optional_json): |
151 | e8d3b957 | Stavros Sachtouris | """Get user quotas"""
|
152 | e8d3b957 | Stavros Sachtouris | |
153 | e8d3b957 | Stavros Sachtouris | _to_format = set(['cyclades.disk', 'pithos.diskspace', 'cyclades.ram']) |
154 | fe4940bc | Stavros Sachtouris | |
155 | e8d3b957 | Stavros Sachtouris | arguments = dict(
|
156 | e8d3b957 | Stavros Sachtouris | bytes=FlagArgument('Show data size in bytes', '--bytes') |
157 | e8d3b957 | Stavros Sachtouris | ) |
158 | fe4940bc | Stavros Sachtouris | |
159 | e8d3b957 | Stavros Sachtouris | def _print_quotas(self, quotas, *args, **kwargs): |
160 | e8d3b957 | Stavros Sachtouris | if not self['bytes']: |
161 | e8d3b957 | Stavros Sachtouris | for category in quotas.values(): |
162 | e8d3b957 | Stavros Sachtouris | for service in self._to_format.intersection(category): |
163 | e8d3b957 | Stavros Sachtouris | for attr, v in category[service].items(): |
164 | e8d3b957 | Stavros Sachtouris | category[service][attr] = format_size(v) |
165 | e8d3b957 | Stavros Sachtouris | self.print_dict(quotas, *args, **kwargs)
|
166 | fe4940bc | Stavros Sachtouris | |
167 | fe4940bc | Stavros Sachtouris | @errors.generic.all
|
168 | e8d3b957 | Stavros Sachtouris | @errors.user.astakosclient
|
169 | e8d3b957 | Stavros Sachtouris | def _run(self): |
170 | e8d3b957 | Stavros Sachtouris | self._print(self.client.get_quotas(), self._print_quotas) |
171 | fe4940bc | Stavros Sachtouris | |
172 | e8d3b957 | Stavros Sachtouris | def main(self): |
173 | fe4940bc | Stavros Sachtouris | super(self.__class__, self)._run() |
174 | e8d3b957 | Stavros Sachtouris | self._run()
|
175 | c308d73f | Stavros Sachtouris | |
176 | c308d73f | Stavros Sachtouris | |
177 | fa7d08b6 | Stavros Sachtouris | # command user session
|
178 | fa7d08b6 | Stavros Sachtouris | |
179 | fa7d08b6 | Stavros Sachtouris | |
180 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
181 | fa7d08b6 | Stavros Sachtouris | class user_session(_init_synnefo_astakosclient): |
182 | fa7d08b6 | Stavros Sachtouris | """User session commands (cached identity calls for kamaki sessions)"""
|
183 | fa7d08b6 | Stavros Sachtouris | |
184 | fa7d08b6 | Stavros Sachtouris | |
185 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
186 | fa7d08b6 | Stavros Sachtouris | class user_session_info(_init_synnefo_astakosclient, _optional_json): |
187 | fa7d08b6 | Stavros Sachtouris | """Get info for (current) session user"""
|
188 | fa7d08b6 | Stavros Sachtouris | |
189 | fa7d08b6 | Stavros Sachtouris | arguments = dict(
|
190 | fa7d08b6 | Stavros Sachtouris | uuid=ValueArgument('Query user with uuid', '--uuid'), |
191 | fa7d08b6 | Stavros Sachtouris | name=ValueArgument('Query user with username/email', '--username') |
192 | fa7d08b6 | Stavros Sachtouris | ) |
193 | fa7d08b6 | Stavros Sachtouris | |
194 | fa7d08b6 | Stavros Sachtouris | @errors.generic.all
|
195 | fa7d08b6 | Stavros Sachtouris | @errors.user.astakosclient
|
196 | fa7d08b6 | Stavros Sachtouris | def _run(self): |
197 | fa7d08b6 | Stavros Sachtouris | if self['uuid'] and self['name']: |
198 | fa7d08b6 | Stavros Sachtouris | raise CLISyntaxError(
|
199 | fa7d08b6 | Stavros Sachtouris | 'Arguments uuid and username are mutually exclusive',
|
200 | fa7d08b6 | Stavros Sachtouris | details=['Use either uuid OR username OR none, not both'])
|
201 | fa7d08b6 | Stavros Sachtouris | uuid = self['uuid'] or (self._username2uuid(self['name']) if ( |
202 | fa7d08b6 | Stavros Sachtouris | self['name']) else None) |
203 | fa7d08b6 | Stavros Sachtouris | try:
|
204 | fa7d08b6 | Stavros Sachtouris | token = self.auth_base.get_token(uuid) if uuid else None |
205 | fa7d08b6 | Stavros Sachtouris | except KeyError: |
206 | fa7d08b6 | Stavros Sachtouris | msg = ('id %s' % self['uuid']) if ( |
207 | fa7d08b6 | Stavros Sachtouris | self['uuid']) else 'username %s' % self['name'] |
208 | fa7d08b6 | Stavros Sachtouris | raise CLIError(
|
209 | fa7d08b6 | Stavros Sachtouris | 'No user with %s in the cached session list' % msg, details=[
|
210 | fa7d08b6 | Stavros Sachtouris | 'To see all cached session users',
|
211 | fa7d08b6 | Stavros Sachtouris | ' /user session list',
|
212 | fa7d08b6 | Stavros Sachtouris | 'To authenticate and add a new user in the session list',
|
213 | fa7d08b6 | Stavros Sachtouris | ' /user session authenticate <new token>'])
|
214 | fa7d08b6 | Stavros Sachtouris | self._print(self.auth_base.user_info(token), self.print_dict) |
215 | fa7d08b6 | Stavros Sachtouris | |
216 | fa7d08b6 | Stavros Sachtouris | |
217 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
218 | fa7d08b6 | Stavros Sachtouris | class user_session_authenticate(_init_synnefo_astakosclient, _optional_json): |
219 | fa7d08b6 | Stavros Sachtouris | """Authenticate a user by token and update cache"""
|
220 | fa7d08b6 | Stavros Sachtouris | |
221 | fa7d08b6 | Stavros Sachtouris | @errors.generic.all
|
222 | fa7d08b6 | Stavros Sachtouris | @errors.user.astakosclient
|
223 | fa7d08b6 | Stavros Sachtouris | def _run(self, token=None): |
224 | fa7d08b6 | Stavros Sachtouris | ask = token and token not in self.auth_base._uuids |
225 | fa7d08b6 | Stavros Sachtouris | self._print(self.auth_base.authenticate(token), self.print_dict) |
226 | fa7d08b6 | Stavros Sachtouris | if ask and self.ask_user( |
227 | fa7d08b6 | Stavros Sachtouris | 'Token is temporarily stored in memory. If it is stored in'
|
228 | fa7d08b6 | Stavros Sachtouris | ' kamaki configuration file, it will be available in later'
|
229 | fa7d08b6 | Stavros Sachtouris | ' sessions. Do you want to permanently store this token?'):
|
230 | fa7d08b6 | Stavros Sachtouris | tokens = self.auth_base._uuids.keys()
|
231 | fa7d08b6 | Stavros Sachtouris | tokens.remove(self.auth_base.token)
|
232 | fa7d08b6 | Stavros Sachtouris | self['config'].set_cloud( |
233 | fa7d08b6 | Stavros Sachtouris | self.cloud, 'token', ' '.join([self.auth_base.token] + tokens)) |
234 | fa7d08b6 | Stavros Sachtouris | self['config'].write() |
235 | fa7d08b6 | Stavros Sachtouris | |
236 | fa7d08b6 | Stavros Sachtouris | def main(self, new_token=None): |
237 | fa7d08b6 | Stavros Sachtouris | super(self.__class__, self)._run() |
238 | fa7d08b6 | Stavros Sachtouris | self._run(token=new_token)
|
239 | fa7d08b6 | Stavros Sachtouris | |
240 | fa7d08b6 | Stavros Sachtouris | |
241 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
242 | fa7d08b6 | Stavros Sachtouris | class user_session_list(_init_synnefo_astakosclient, _optional_json): |
243 | fa7d08b6 | Stavros Sachtouris | """List cached users"""
|
244 | fa7d08b6 | Stavros Sachtouris | |
245 | fa7d08b6 | Stavros Sachtouris | arguments = dict(
|
246 | fa7d08b6 | Stavros Sachtouris | detail=FlagArgument('Detailed listing', ('-l', '--detail')) |
247 | fa7d08b6 | Stavros Sachtouris | ) |
248 | fa7d08b6 | Stavros Sachtouris | |
249 | fa7d08b6 | Stavros Sachtouris | @errors.generic.all
|
250 | fa7d08b6 | Stavros Sachtouris | @errors.user.astakosclient
|
251 | fa7d08b6 | Stavros Sachtouris | def _run(self): |
252 | fa7d08b6 | Stavros Sachtouris | self._print([u if self['detail'] else (dict( |
253 | fa7d08b6 | Stavros Sachtouris | id=u['id'], name=u['name'])) for u in self.auth_base.list_users()]) |
254 | fa7d08b6 | Stavros Sachtouris | |
255 | fa7d08b6 | Stavros Sachtouris | def main(self): |
256 | fa7d08b6 | Stavros Sachtouris | super(self.__class__, self)._run() |
257 | fa7d08b6 | Stavros Sachtouris | self._run()
|
258 | fa7d08b6 | Stavros Sachtouris | |
259 | fa7d08b6 | Stavros Sachtouris | |
260 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
261 | fa7d08b6 | Stavros Sachtouris | class user_session_select(_init_synnefo_astakosclient): |
262 | fa7d08b6 | Stavros Sachtouris | """Pick a user from the cached list to be the current session user"""
|
263 | fa7d08b6 | Stavros Sachtouris | |
264 | fa7d08b6 | Stavros Sachtouris | @errors.generic.all
|
265 | fa7d08b6 | Stavros Sachtouris | @errors.user.astakosclient
|
266 | fa7d08b6 | Stavros Sachtouris | def _run(self, uuid): |
267 | fa7d08b6 | Stavros Sachtouris | try:
|
268 | fa7d08b6 | Stavros Sachtouris | first_token = self.auth_base.get_token(uuid)
|
269 | fa7d08b6 | Stavros Sachtouris | except KeyError: |
270 | fa7d08b6 | Stavros Sachtouris | raise CLIError(
|
271 | fa7d08b6 | Stavros Sachtouris | 'No user with uuid %s in the cached session list' % uuid,
|
272 | fa7d08b6 | Stavros Sachtouris | details=[ |
273 | fa7d08b6 | Stavros Sachtouris | 'To see all cached session users',
|
274 | fa7d08b6 | Stavros Sachtouris | ' /user session list',
|
275 | fa7d08b6 | Stavros Sachtouris | 'To authenticate and add a new user in the session list',
|
276 | fa7d08b6 | Stavros Sachtouris | ' /user session authenticate <new token>'])
|
277 | fa7d08b6 | Stavros Sachtouris | if self.auth_base.token != first_token: |
278 | fa7d08b6 | Stavros Sachtouris | self.auth_base.token = first_token
|
279 | fa7d08b6 | Stavros Sachtouris | msg = 'User with id %s is now the current session user.\n' % uuid
|
280 | fa7d08b6 | Stavros Sachtouris | msg += 'Do you want future sessions to also start with this user?'
|
281 | fa7d08b6 | Stavros Sachtouris | if self.ask_user(msg): |
282 | fa7d08b6 | Stavros Sachtouris | tokens = self.auth_base._uuids.keys()
|
283 | fa7d08b6 | Stavros Sachtouris | tokens.remove(self.auth_base.token)
|
284 | fa7d08b6 | Stavros Sachtouris | tokens.insert(0, self.auth_base.token) |
285 | fa7d08b6 | Stavros Sachtouris | self['config'].set_cloud( |
286 | fa7d08b6 | Stavros Sachtouris | self.cloud, 'token', ' '.join(tokens)) |
287 | fa7d08b6 | Stavros Sachtouris | self['config'].write() |
288 | fa7d08b6 | Stavros Sachtouris | self.error('User is selected for next sessions') |
289 | fa7d08b6 | Stavros Sachtouris | else:
|
290 | fa7d08b6 | Stavros Sachtouris | self.error('User is not permanently selected') |
291 | fa7d08b6 | Stavros Sachtouris | else:
|
292 | fa7d08b6 | Stavros Sachtouris | self.error('User was already the selected session user') |
293 | fa7d08b6 | Stavros Sachtouris | |
294 | fa7d08b6 | Stavros Sachtouris | def main(self, user_uuid): |
295 | fa7d08b6 | Stavros Sachtouris | super(self.__class__, self)._run() |
296 | fa7d08b6 | Stavros Sachtouris | self._run(uuid=user_uuid)
|
297 | fa7d08b6 | Stavros Sachtouris | |
298 | fa7d08b6 | Stavros Sachtouris | |
299 | fa7d08b6 | Stavros Sachtouris | @command(user_commands)
|
300 | fa7d08b6 | Stavros Sachtouris | class user_session_remove(_init_synnefo_astakosclient): |
301 | fa7d08b6 | Stavros Sachtouris | """Delete a user (token) from the cached list of session users"""
|
302 | fa7d08b6 | Stavros Sachtouris | |
303 | fa7d08b6 | Stavros Sachtouris | @errors.generic.all
|
304 | fa7d08b6 | Stavros Sachtouris | @errors.user.astakosclient
|
305 | fa7d08b6 | Stavros Sachtouris | def _run(self, uuid): |
306 | fa7d08b6 | Stavros Sachtouris | if uuid == self.auth_base.user_term('id'): |
307 | fa7d08b6 | Stavros Sachtouris | raise CLIError('Cannot remove current session user', details=[ |
308 | fa7d08b6 | Stavros Sachtouris | 'To see all cached session users',
|
309 | fa7d08b6 | Stavros Sachtouris | ' /user session list',
|
310 | fa7d08b6 | Stavros Sachtouris | 'To see current session user',
|
311 | fa7d08b6 | Stavros Sachtouris | ' /user session info',
|
312 | fa7d08b6 | Stavros Sachtouris | 'To select a different session user',
|
313 | fa7d08b6 | Stavros Sachtouris | ' /user session select <user uuid>'])
|
314 | fa7d08b6 | Stavros Sachtouris | try:
|
315 | fa7d08b6 | Stavros Sachtouris | self.auth_base.remove_user(uuid)
|
316 | fa7d08b6 | Stavros Sachtouris | except KeyError: |
317 | fa7d08b6 | Stavros Sachtouris | raise CLIError('No user with uuid %s in session list' % uuid, |
318 | fa7d08b6 | Stavros Sachtouris | details=[ |
319 | fa7d08b6 | Stavros Sachtouris | 'To see all cached session users',
|
320 | fa7d08b6 | Stavros Sachtouris | ' /user session list',
|
321 | fa7d08b6 | Stavros Sachtouris | 'To authenticate and add a new user in the session list',
|
322 | fa7d08b6 | Stavros Sachtouris | ' /user session authenticate <new token>'])
|
323 | fa7d08b6 | Stavros Sachtouris | if self.ask_user( |
324 | fa7d08b6 | Stavros Sachtouris | 'User is removed from current session, but will be restored in'
|
325 | fa7d08b6 | Stavros Sachtouris | ' the next session. Remove the user from future sessions?'):
|
326 | fa7d08b6 | Stavros Sachtouris | self['config'].set_cloud( |
327 | fa7d08b6 | Stavros Sachtouris | self.cloud, 'token', ' '.join(self.auth_base._uuids.keys())) |
328 | fa7d08b6 | Stavros Sachtouris | self['config'].write() |
329 | fa7d08b6 | Stavros Sachtouris | |
330 | fa7d08b6 | Stavros Sachtouris | def main(self, user_uuid): |
331 | fa7d08b6 | Stavros Sachtouris | super(self.__class__, self)._run() |
332 | fa7d08b6 | Stavros Sachtouris | self._run(uuid=user_uuid)
|
333 | fa7d08b6 | Stavros Sachtouris | |
334 | fa7d08b6 | Stavros Sachtouris | |
335 | ab863157 | Stavros Sachtouris | # command admin
|
336 | ab863157 | Stavros Sachtouris | |
337 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
338 | ab863157 | Stavros Sachtouris | class admin_service(_init_synnefo_astakosclient): |
339 | ab863157 | Stavros Sachtouris | """Manage commissions (special privileges required)"""
|
340 | ab863157 | Stavros Sachtouris | |
341 | ab863157 | Stavros Sachtouris | |
342 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
343 | ab863157 | Stavros Sachtouris | class admin_service_list(_init_synnefo_astakosclient, _optional_json): |
344 | ab863157 | Stavros Sachtouris | """List available services"""
|
345 | ab863157 | Stavros Sachtouris | |
346 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
347 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
348 | ab863157 | Stavros Sachtouris | def _run(self): |
349 | ab863157 | Stavros Sachtouris | self._print(self.client.get_services()) |
350 | ab863157 | Stavros Sachtouris | |
351 | ab863157 | Stavros Sachtouris | def main(self): |
352 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
353 | ab863157 | Stavros Sachtouris | self._run()
|
354 | ab863157 | Stavros Sachtouris | |
355 | ab863157 | Stavros Sachtouris | |
356 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
357 | ab863157 | Stavros Sachtouris | class admin_service_uuid2username(_init_synnefo_astakosclient, _optional_json): |
358 | ab863157 | Stavros Sachtouris | """Get service username(s) from uuid(s)"""
|
359 | ab863157 | Stavros Sachtouris | |
360 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
361 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
362 | ab863157 | Stavros Sachtouris | @with_temp_token
|
363 | ab863157 | Stavros Sachtouris | def _run(self, uuids): |
364 | ab863157 | Stavros Sachtouris | if 1 == len(uuids): |
365 | ab863157 | Stavros Sachtouris | self._print(self.client.service_get_username(uuids[0])) |
366 | ab863157 | Stavros Sachtouris | else:
|
367 | ab863157 | Stavros Sachtouris | self._print(
|
368 | ab863157 | Stavros Sachtouris | self.client.service_get_usernames(uuids),
|
369 | ab863157 | Stavros Sachtouris | self.print_dict)
|
370 | ab863157 | Stavros Sachtouris | |
371 | ab863157 | Stavros Sachtouris | def main(self, service_token, uuid, *more_uuids): |
372 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
373 | ab863157 | Stavros Sachtouris | self._run([uuid] + list(more_uuids), token=service_token) |
374 | ab863157 | Stavros Sachtouris | |
375 | ab863157 | Stavros Sachtouris | |
376 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
377 | ab863157 | Stavros Sachtouris | class admin_service_username2uuid(_init_synnefo_astakosclient, _optional_json): |
378 | ab863157 | Stavros Sachtouris | """Get service uuid(s) from username(s)"""
|
379 | ab863157 | Stavros Sachtouris | |
380 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
381 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
382 | ab863157 | Stavros Sachtouris | @with_temp_token
|
383 | ab863157 | Stavros Sachtouris | def _run(self, usernames): |
384 | ab863157 | Stavros Sachtouris | if 1 == len(usernames): |
385 | ab863157 | Stavros Sachtouris | self._print(self.client.service_get_uuid(usernames[0])) |
386 | ab863157 | Stavros Sachtouris | else:
|
387 | ab863157 | Stavros Sachtouris | self._print(
|
388 | ab863157 | Stavros Sachtouris | self.client.service_get_uuids(usernames),
|
389 | ab863157 | Stavros Sachtouris | self.print_dict)
|
390 | ab863157 | Stavros Sachtouris | |
391 | ab863157 | Stavros Sachtouris | def main(self, service_token, usernames, *more_usernames): |
392 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
393 | ab863157 | Stavros Sachtouris | self._run([usernames] + list(more_usernames), token=service_token) |
394 | ab863157 | Stavros Sachtouris | |
395 | ab863157 | Stavros Sachtouris | |
396 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
397 | ab863157 | Stavros Sachtouris | class admin_service_quotas(_init_synnefo_astakosclient, _optional_json): |
398 | ab863157 | Stavros Sachtouris | """Get service quotas"""
|
399 | ab863157 | Stavros Sachtouris | |
400 | ab863157 | Stavros Sachtouris | arguments = dict(
|
401 | ab863157 | Stavros Sachtouris | uuid=ValueArgument('A user uuid to get quotas for', '--uuid') |
402 | ab863157 | Stavros Sachtouris | ) |
403 | ab863157 | Stavros Sachtouris | |
404 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
405 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
406 | ab863157 | Stavros Sachtouris | @with_temp_token
|
407 | ab863157 | Stavros Sachtouris | def _run(self): |
408 | ab863157 | Stavros Sachtouris | self._print(self.client.service_get_quotas(self['uuid'])) |
409 | ab863157 | Stavros Sachtouris | |
410 | ab863157 | Stavros Sachtouris | def main(self, service_token): |
411 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
412 | ab863157 | Stavros Sachtouris | self._run(token=service_token)
|
413 | ab863157 | Stavros Sachtouris | |
414 | ab863157 | Stavros Sachtouris | |
415 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
416 | ab863157 | Stavros Sachtouris | class admin_commission(_init_synnefo_astakosclient): |
417 | ab863157 | Stavros Sachtouris | """Manage commissions (special privileges required)"""
|
418 | ab863157 | Stavros Sachtouris | |
419 | ab863157 | Stavros Sachtouris | |
420 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
421 | ab863157 | Stavros Sachtouris | class admin_commission_pending(_init_synnefo_astakosclient, _optional_json): |
422 | ab863157 | Stavros Sachtouris | """List pending commissions (special privileges required)"""
|
423 | ab863157 | Stavros Sachtouris | |
424 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
425 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
426 | ab863157 | Stavros Sachtouris | def _run(self): |
427 | ab863157 | Stavros Sachtouris | self._print(self.client.get_pending_commissions()) |
428 | ab863157 | Stavros Sachtouris | |
429 | ab863157 | Stavros Sachtouris | def main(self): |
430 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
431 | ab863157 | Stavros Sachtouris | self._run()
|
432 | ab863157 | Stavros Sachtouris | |
433 | ab863157 | Stavros Sachtouris | |
434 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
435 | ab863157 | Stavros Sachtouris | class admin_commission_info(_init_synnefo_astakosclient, _optional_json): |
436 | ab863157 | Stavros Sachtouris | """Get commission info (special privileges required)"""
|
437 | ab863157 | Stavros Sachtouris | |
438 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
439 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
440 | ab863157 | Stavros Sachtouris | def _run(self, commission_id): |
441 | ab863157 | Stavros Sachtouris | commission_id = int(commission_id)
|
442 | ab863157 | Stavros Sachtouris | self._print(
|
443 | ab863157 | Stavros Sachtouris | self.client.get_commission_info(commission_id), self.print_dict) |
444 | ab863157 | Stavros Sachtouris | |
445 | ab863157 | Stavros Sachtouris | def main(self, commission_id): |
446 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
447 | ab863157 | Stavros Sachtouris | self._run(commission_id)
|
448 | ab863157 | Stavros Sachtouris | |
449 | ab863157 | Stavros Sachtouris | |
450 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
451 | ab863157 | Stavros Sachtouris | class admin_commission_accept(_init_synnefo_astakosclient): |
452 | ab863157 | Stavros Sachtouris | """Accept a pending commission (special privileges required)"""
|
453 | ab863157 | Stavros Sachtouris | |
454 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
455 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
456 | ab863157 | Stavros Sachtouris | def _run(self, commission_id): |
457 | ab863157 | Stavros Sachtouris | commission_id = int(commission_id)
|
458 | ab863157 | Stavros Sachtouris | self.client.accept_commission(commission_id)
|
459 | ab863157 | Stavros Sachtouris | |
460 | ab863157 | Stavros Sachtouris | def main(self, commission_id): |
461 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
462 | ab863157 | Stavros Sachtouris | self._run(commission_id)
|
463 | ab863157 | Stavros Sachtouris | |
464 | ab863157 | Stavros Sachtouris | |
465 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
466 | ab863157 | Stavros Sachtouris | class admin_commission_reject(_init_synnefo_astakosclient): |
467 | ab863157 | Stavros Sachtouris | """Reject a pending commission (special privileges required)"""
|
468 | ab863157 | Stavros Sachtouris | |
469 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
470 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
471 | ab863157 | Stavros Sachtouris | def _run(self, commission_id): |
472 | ab863157 | Stavros Sachtouris | commission_id = int(commission_id)
|
473 | ab863157 | Stavros Sachtouris | self.client.reject_commission(commission_id)
|
474 | ab863157 | Stavros Sachtouris | |
475 | ab863157 | Stavros Sachtouris | def main(self, commission_id): |
476 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
477 | ab863157 | Stavros Sachtouris | self._run(commission_id)
|
478 | ab863157 | Stavros Sachtouris | |
479 | ab863157 | Stavros Sachtouris | |
480 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
481 | ab863157 | Stavros Sachtouris | class admin_commission_resolve(_init_synnefo_astakosclient, _optional_json): |
482 | ab863157 | Stavros Sachtouris | """Resolve multiple commissions (special privileges required)"""
|
483 | ab863157 | Stavros Sachtouris | |
484 | ab863157 | Stavros Sachtouris | arguments = dict(
|
485 | ab863157 | Stavros Sachtouris | accept=CommaSeparatedListArgument( |
486 | ab863157 | Stavros Sachtouris | 'commission ids to accept (e.g., --accept=11,12,13,...',
|
487 | ab863157 | Stavros Sachtouris | '--accept'),
|
488 | ab863157 | Stavros Sachtouris | reject=CommaSeparatedListArgument( |
489 | ab863157 | Stavros Sachtouris | 'commission ids to reject (e.g., --reject=11,12,13,...',
|
490 | ab863157 | Stavros Sachtouris | '--reject')
|
491 | ab863157 | Stavros Sachtouris | ) |
492 | ab863157 | Stavros Sachtouris | |
493 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
494 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
495 | ab863157 | Stavros Sachtouris | def _run(self): |
496 | ab863157 | Stavros Sachtouris | self.writeln('accepted ', self['accept']) |
497 | ab863157 | Stavros Sachtouris | self.writeln('rejected ', self['reject']) |
498 | ab863157 | Stavros Sachtouris | self._print(
|
499 | ab863157 | Stavros Sachtouris | self.client.resolve_commissions(self['accept'], self['reject']), |
500 | ab863157 | Stavros Sachtouris | self.print_dict)
|
501 | ab863157 | Stavros Sachtouris | |
502 | ab863157 | Stavros Sachtouris | def main(self): |
503 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
504 | ab863157 | Stavros Sachtouris | self._run()
|
505 | ab863157 | Stavros Sachtouris | |
506 | ab863157 | Stavros Sachtouris | |
507 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
508 | ab863157 | Stavros Sachtouris | class admin_commission_issue(_init_synnefo_astakosclient, _optional_json): |
509 | ab863157 | Stavros Sachtouris | """Issue commissions as a json string (special privileges required)
|
510 | ab863157 | Stavros Sachtouris | Parameters:
|
511 | ab863157 | Stavros Sachtouris | holder -- user's id (string)
|
512 | ab863157 | Stavros Sachtouris | source -- commission's source (ex system) (string)
|
513 | ab863157 | Stavros Sachtouris | provisions -- resources with their quantity (json-dict from string to int)
|
514 | ab863157 | Stavros Sachtouris | name -- description of the commission (string)
|
515 | ab863157 | Stavros Sachtouris | """
|
516 | ab863157 | Stavros Sachtouris | |
517 | ab863157 | Stavros Sachtouris | arguments = dict(
|
518 | ab863157 | Stavros Sachtouris | force=FlagArgument('Force commission', '--force'), |
519 | ab863157 | Stavros Sachtouris | accept=FlagArgument('Do not wait for verification', '--accept') |
520 | ab863157 | Stavros Sachtouris | ) |
521 | ab863157 | Stavros Sachtouris | |
522 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
523 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
524 | ab863157 | Stavros Sachtouris | def _run(self, holder, source, provisions, name=''): |
525 | ab863157 | Stavros Sachtouris | provisions = loads(provisions) |
526 | ab863157 | Stavros Sachtouris | self._print(self.client.issue_one_commission( |
527 | ab863157 | Stavros Sachtouris | holder, source, provisions, name, |
528 | ab863157 | Stavros Sachtouris | self['force'], self['accept'])) |
529 | ab863157 | Stavros Sachtouris | |
530 | ab863157 | Stavros Sachtouris | def main(self, user_uuid, source, provisions_file, name=''): |
531 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
532 | ab863157 | Stavros Sachtouris | self._run(user_uuid, source, provisions_file, name)
|
533 | ab863157 | Stavros Sachtouris | |
534 | ab863157 | Stavros Sachtouris | |
535 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
536 | ab863157 | Stavros Sachtouris | class admin_resources(_init_synnefo_astakosclient, _optional_json): |
537 | ab863157 | Stavros Sachtouris | """List user resources"""
|
538 | ab863157 | Stavros Sachtouris | |
539 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
540 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
541 | ab863157 | Stavros Sachtouris | def _run(self): |
542 | ab863157 | Stavros Sachtouris | self._print(self.client.get_resources(), self.print_dict) |
543 | ab863157 | Stavros Sachtouris | |
544 | ab863157 | Stavros Sachtouris | def main(self): |
545 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
546 | ab863157 | Stavros Sachtouris | self._run()
|
547 | ab863157 | Stavros Sachtouris | |
548 | ab863157 | Stavros Sachtouris | |
549 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
550 | ab863157 | Stavros Sachtouris | class admin_feedback(_init_synnefo_astakosclient): |
551 | ab863157 | Stavros Sachtouris | """Send feedback to server"""
|
552 | ab863157 | Stavros Sachtouris | |
553 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
554 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
555 | ab863157 | Stavros Sachtouris | def _run(self, msg, more_info=None): |
556 | ab863157 | Stavros Sachtouris | self.client.send_feedback(msg, more_info or '') |
557 | ab863157 | Stavros Sachtouris | |
558 | ab863157 | Stavros Sachtouris | def main(self, message, more_info=None): |
559 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
560 | ab863157 | Stavros Sachtouris | self._run(message, more_info)
|
561 | ab863157 | Stavros Sachtouris | |
562 | ab863157 | Stavros Sachtouris | |
563 | ab863157 | Stavros Sachtouris | @command(admin_commands)
|
564 | ab863157 | Stavros Sachtouris | class admin_endpoints(_init_synnefo_astakosclient, _optional_json): |
565 | ab863157 | Stavros Sachtouris | """Get endpoints service endpoints"""
|
566 | ab863157 | Stavros Sachtouris | |
567 | ab863157 | Stavros Sachtouris | @errors.generic.all
|
568 | ab863157 | Stavros Sachtouris | @errors.user.astakosclient
|
569 | ab863157 | Stavros Sachtouris | def _run(self): |
570 | fa7d08b6 | Stavros Sachtouris | self._print(self.client.get_endpoints(), self.print_dict) |
571 | ab863157 | Stavros Sachtouris | |
572 | ab863157 | Stavros Sachtouris | def main(self): |
573 | ab863157 | Stavros Sachtouris | super(self.__class__, self)._run() |
574 | ab863157 | Stavros Sachtouris | self._run()
|
575 | ab863157 | Stavros Sachtouris | |
576 | ab863157 | Stavros Sachtouris | |
577 | c308d73f | Stavros Sachtouris | # command project
|
578 | c308d73f | Stavros Sachtouris | |
579 | c308d73f | Stavros Sachtouris | |
580 | c308d73f | Stavros Sachtouris | _project_specs = """
|
581 | c308d73f | Stavros Sachtouris | {
|
582 | c308d73f | Stavros Sachtouris | "name": name,
|
583 | c308d73f | Stavros Sachtouris | "owner": uuid,
|
584 | c308d73f | Stavros Sachtouris | "homepage": homepage, # optional
|
585 | c308d73f | Stavros Sachtouris | "description": description, # optional
|
586 | c308d73f | Stavros Sachtouris | "comments": comments, # optional
|
587 | c308d73f | Stavros Sachtouris | "start_date": date, # optional
|
588 | c308d73f | Stavros Sachtouris | "end_date": date,
|
589 | c308d73f | Stavros Sachtouris | "join_policy": "auto" | "moderated" | "closed", # default: "moderated"
|
590 | c308d73f | Stavros Sachtouris | "leave_policy": "auto" | "moderated" | "closed", # default: "auto"
|
591 | c308d73f | Stavros Sachtouris | "resources": {
|
592 | c308d73f | Stavros Sachtouris | "cyclades.vm": {
|
593 | c308d73f | Stavros Sachtouris | "project_capacity": int or null,
|
594 | c308d73f | Stavros Sachtouris | "member_capacity": int
|
595 | c308d73f | Stavros Sachtouris | }
|
596 | c308d73f | Stavros Sachtouris | }
|
597 | c308d73f | Stavros Sachtouris | }
|
598 | c308d73f | Stavros Sachtouris | """
|
599 | c308d73f | Stavros Sachtouris | |
600 | c308d73f | Stavros Sachtouris | |
601 | c308d73f | Stavros Sachtouris | def apply_notification(foo): |
602 | c308d73f | Stavros Sachtouris | def wrap(self, *args, **kwargs): |
603 | c308d73f | Stavros Sachtouris | r = foo(self, *args, **kwargs)
|
604 | c308d73f | Stavros Sachtouris | self.writeln('Application is submitted successfully') |
605 | c308d73f | Stavros Sachtouris | return r
|
606 | c308d73f | Stavros Sachtouris | return wrap
|
607 | c308d73f | Stavros Sachtouris | |
608 | c308d73f | Stavros Sachtouris | |
609 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
610 | c308d73f | Stavros Sachtouris | class project_list(_init_synnefo_astakosclient, _optional_json): |
611 | c308d73f | Stavros Sachtouris | """List all projects"""
|
612 | c308d73f | Stavros Sachtouris | |
613 | c308d73f | Stavros Sachtouris | arguments = dict(
|
614 | c308d73f | Stavros Sachtouris | name=ValueArgument('Filter by name', ('--with-name', )), |
615 | c308d73f | Stavros Sachtouris | state=ValueArgument('Filter by state', ('--with-state', )), |
616 | c308d73f | Stavros Sachtouris | owner=ValueArgument('Filter by owner', ('--with-owner', )) |
617 | c308d73f | Stavros Sachtouris | ) |
618 | c308d73f | Stavros Sachtouris | |
619 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
620 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
621 | c308d73f | Stavros Sachtouris | def _run(self): |
622 | c308d73f | Stavros Sachtouris | self._print(self.client.get_projects( |
623 | c308d73f | Stavros Sachtouris | self['name'], self['state'], self['owner'])) |
624 | c308d73f | Stavros Sachtouris | |
625 | c308d73f | Stavros Sachtouris | def main(self): |
626 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
627 | c308d73f | Stavros Sachtouris | self._run()
|
628 | c308d73f | Stavros Sachtouris | |
629 | c308d73f | Stavros Sachtouris | |
630 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
631 | c308d73f | Stavros Sachtouris | class project_info(_init_synnefo_astakosclient, _optional_json): |
632 | c308d73f | Stavros Sachtouris | """Get details for a project"""
|
633 | c308d73f | Stavros Sachtouris | |
634 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
635 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
636 | c308d73f | Stavros Sachtouris | def _run(self, project_id): |
637 | c308d73f | Stavros Sachtouris | self._print(
|
638 | c308d73f | Stavros Sachtouris | self.client.get_project(project_id), self.print_dict) |
639 | c308d73f | Stavros Sachtouris | |
640 | c308d73f | Stavros Sachtouris | def main(self, project_id): |
641 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
642 | c308d73f | Stavros Sachtouris | self._run(project_id)
|
643 | c308d73f | Stavros Sachtouris | |
644 | c308d73f | Stavros Sachtouris | |
645 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
646 | c308d73f | Stavros Sachtouris | class project_create(_init_synnefo_astakosclient, _optional_json): |
647 | c308d73f | Stavros Sachtouris | """Apply for a new project (input a json-dict)
|
648 | c308d73f | Stavros Sachtouris | Project details must be provided as a json-formated dict from the standard
|
649 | c308d73f | Stavros Sachtouris | input, or through a file
|
650 | c308d73f | Stavros Sachtouris | """
|
651 | c308d73f | Stavros Sachtouris | |
652 | c308d73f | Stavros Sachtouris | __doc__ += _project_specs |
653 | c308d73f | Stavros Sachtouris | |
654 | c308d73f | Stavros Sachtouris | arguments = dict(
|
655 | c308d73f | Stavros Sachtouris | specs_path=ValueArgument( |
656 | c308d73f | Stavros Sachtouris | 'Specification file path (content must be in json)', '--spec-file') |
657 | c308d73f | Stavros Sachtouris | ) |
658 | c308d73f | Stavros Sachtouris | |
659 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
660 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
661 | c308d73f | Stavros Sachtouris | @apply_notification
|
662 | c308d73f | Stavros Sachtouris | def _run(self): |
663 | c308d73f | Stavros Sachtouris | input_stream = open(abspath(self['specs_path'])) if ( |
664 | c308d73f | Stavros Sachtouris | self['specs_path']) else self._in |
665 | c308d73f | Stavros Sachtouris | specs = load(input_stream) |
666 | c308d73f | Stavros Sachtouris | self._print(
|
667 | c308d73f | Stavros Sachtouris | self.client.create_project(specs), self.print_dict) |
668 | c308d73f | Stavros Sachtouris | |
669 | c308d73f | Stavros Sachtouris | def main(self): |
670 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
671 | c308d73f | Stavros Sachtouris | self._run()
|
672 | c308d73f | Stavros Sachtouris | |
673 | c308d73f | Stavros Sachtouris | |
674 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
675 | c308d73f | Stavros Sachtouris | class project_modify(_init_synnefo_astakosclient, _optional_json): |
676 | c308d73f | Stavros Sachtouris | """Modify a project (input a json-dict)
|
677 | c308d73f | Stavros Sachtouris | Project details must be provided as a json-formated dict from the standard
|
678 | c308d73f | Stavros Sachtouris | input, or through a file
|
679 | c308d73f | Stavros Sachtouris | """
|
680 | c308d73f | Stavros Sachtouris | |
681 | c308d73f | Stavros Sachtouris | __doc__ += _project_specs |
682 | c308d73f | Stavros Sachtouris | |
683 | c308d73f | Stavros Sachtouris | arguments = dict(
|
684 | c308d73f | Stavros Sachtouris | specs_path=ValueArgument( |
685 | c308d73f | Stavros Sachtouris | 'Specification file path (content must be in json)', '--spec-file') |
686 | c308d73f | Stavros Sachtouris | ) |
687 | c308d73f | Stavros Sachtouris | |
688 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
689 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
690 | c308d73f | Stavros Sachtouris | @apply_notification
|
691 | c308d73f | Stavros Sachtouris | def _run(self, project_id): |
692 | c308d73f | Stavros Sachtouris | input_stream = open(abspath(self['specs_path'])) if ( |
693 | c308d73f | Stavros Sachtouris | self['specs_path']) else self._in |
694 | c308d73f | Stavros Sachtouris | specs = load(input_stream) |
695 | c308d73f | Stavros Sachtouris | self._print(
|
696 | c308d73f | Stavros Sachtouris | self.client.modify_project(project_id, specs),
|
697 | c308d73f | Stavros Sachtouris | self.print_dict)
|
698 | c308d73f | Stavros Sachtouris | |
699 | c308d73f | Stavros Sachtouris | def main(self, project_id): |
700 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
701 | c308d73f | Stavros Sachtouris | self._run(project_id)
|
702 | c308d73f | Stavros Sachtouris | |
703 | c308d73f | Stavros Sachtouris | |
704 | c308d73f | Stavros Sachtouris | class _project_action(_init_synnefo_astakosclient): |
705 | c308d73f | Stavros Sachtouris | |
706 | c308d73f | Stavros Sachtouris | action = ''
|
707 | c308d73f | Stavros Sachtouris | |
708 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
709 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
710 | c308d73f | Stavros Sachtouris | def _run(self, project_id, quote_a_reason): |
711 | c308d73f | Stavros Sachtouris | self.client.project_action(project_id, self.action, quote_a_reason) |
712 | c308d73f | Stavros Sachtouris | |
713 | c308d73f | Stavros Sachtouris | def main(self, project_id, quote_a_reason=''): |
714 | c308d73f | Stavros Sachtouris | super(_project_action, self)._run() |
715 | c308d73f | Stavros Sachtouris | self._run(project_id, quote_a_reason)
|
716 | c308d73f | Stavros Sachtouris | |
717 | c308d73f | Stavros Sachtouris | |
718 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
719 | c308d73f | Stavros Sachtouris | class project_suspend(_project_action): |
720 | c308d73f | Stavros Sachtouris | """Suspend a project (special privileges needed)"""
|
721 | c308d73f | Stavros Sachtouris | action = 'suspend'
|
722 | c308d73f | Stavros Sachtouris | |
723 | c308d73f | Stavros Sachtouris | |
724 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
725 | c308d73f | Stavros Sachtouris | class project_unsuspend(_project_action): |
726 | c308d73f | Stavros Sachtouris | """Resume a suspended project (special privileges needed)"""
|
727 | c308d73f | Stavros Sachtouris | action = 'unsuspend'
|
728 | c308d73f | Stavros Sachtouris | |
729 | c308d73f | Stavros Sachtouris | |
730 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
731 | c308d73f | Stavros Sachtouris | class project_terminate(_project_action): |
732 | c308d73f | Stavros Sachtouris | """Terminate a project (special privileges needed)"""
|
733 | c308d73f | Stavros Sachtouris | action = 'terminate'
|
734 | c308d73f | Stavros Sachtouris | |
735 | c308d73f | Stavros Sachtouris | |
736 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
737 | c308d73f | Stavros Sachtouris | class project_reinstate(_project_action): |
738 | c308d73f | Stavros Sachtouris | """Reinstate a terminated project (special privileges needed)"""
|
739 | c308d73f | Stavros Sachtouris | action = 'reinstate'
|
740 | c308d73f | Stavros Sachtouris | |
741 | c308d73f | Stavros Sachtouris | |
742 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
743 | c308d73f | Stavros Sachtouris | class project_application(_init_synnefo_astakosclient): |
744 | c308d73f | Stavros Sachtouris | """Application management commands"""
|
745 | c308d73f | Stavros Sachtouris | |
746 | c308d73f | Stavros Sachtouris | |
747 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
748 | c308d73f | Stavros Sachtouris | class project_application_list(_init_synnefo_astakosclient, _optional_json): |
749 | c308d73f | Stavros Sachtouris | """List all applications (old and new)"""
|
750 | c308d73f | Stavros Sachtouris | |
751 | c308d73f | Stavros Sachtouris | arguments = dict(
|
752 | c308d73f | Stavros Sachtouris | project=IntArgument('Filter by project id', '--with-project-id') |
753 | c308d73f | Stavros Sachtouris | ) |
754 | c308d73f | Stavros Sachtouris | |
755 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
756 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
757 | c308d73f | Stavros Sachtouris | def _run(self): |
758 | c308d73f | Stavros Sachtouris | self._print(self.client.get_applications(self['project'])) |
759 | c308d73f | Stavros Sachtouris | |
760 | c308d73f | Stavros Sachtouris | def main(self): |
761 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
762 | c308d73f | Stavros Sachtouris | self._run()
|
763 | c308d73f | Stavros Sachtouris | |
764 | c308d73f | Stavros Sachtouris | |
765 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
766 | c308d73f | Stavros Sachtouris | class project_application_info(_init_synnefo_astakosclient, _optional_json): |
767 | c308d73f | Stavros Sachtouris | """Get details on an application"""
|
768 | c308d73f | Stavros Sachtouris | |
769 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
770 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
771 | c308d73f | Stavros Sachtouris | def _run(self, app_id): |
772 | c308d73f | Stavros Sachtouris | self._print(
|
773 | c308d73f | Stavros Sachtouris | self.client.get_application(app_id), self.print_dict) |
774 | c308d73f | Stavros Sachtouris | |
775 | c308d73f | Stavros Sachtouris | def main(self, application_id): |
776 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
777 | c308d73f | Stavros Sachtouris | self._run(application_id)
|
778 | c308d73f | Stavros Sachtouris | |
779 | c308d73f | Stavros Sachtouris | |
780 | c308d73f | Stavros Sachtouris | class _application_action(_init_synnefo_astakosclient): |
781 | c308d73f | Stavros Sachtouris | |
782 | c308d73f | Stavros Sachtouris | action = ''
|
783 | c308d73f | Stavros Sachtouris | |
784 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
785 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
786 | c308d73f | Stavros Sachtouris | def _run(self, app_id, quote_a_reason): |
787 | c308d73f | Stavros Sachtouris | self.client.application_action(app_id, self.action, quote_a_reason) |
788 | c308d73f | Stavros Sachtouris | |
789 | c308d73f | Stavros Sachtouris | def main(self, application_id, quote_a_reason=''): |
790 | c308d73f | Stavros Sachtouris | super(_application_action, self)._run() |
791 | c308d73f | Stavros Sachtouris | self._run(application_id, quote_a_reason)
|
792 | c308d73f | Stavros Sachtouris | |
793 | c308d73f | Stavros Sachtouris | |
794 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
795 | c308d73f | Stavros Sachtouris | class project_application_approve(_application_action): |
796 | c308d73f | Stavros Sachtouris | """Approve an application (special privileges needed)"""
|
797 | c308d73f | Stavros Sachtouris | action = 'approve'
|
798 | c308d73f | Stavros Sachtouris | |
799 | c308d73f | Stavros Sachtouris | |
800 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
801 | c308d73f | Stavros Sachtouris | class project_application_deny(_application_action): |
802 | c308d73f | Stavros Sachtouris | """Deny an application (special privileges needed)"""
|
803 | c308d73f | Stavros Sachtouris | action = 'deny'
|
804 | c308d73f | Stavros Sachtouris | |
805 | c308d73f | Stavros Sachtouris | |
806 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
807 | c308d73f | Stavros Sachtouris | class project_application_dismiss(_application_action): |
808 | c308d73f | Stavros Sachtouris | """Dismiss your denied application"""
|
809 | c308d73f | Stavros Sachtouris | action = 'dismiss'
|
810 | c308d73f | Stavros Sachtouris | |
811 | c308d73f | Stavros Sachtouris | |
812 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
813 | c308d73f | Stavros Sachtouris | class project_application_cancel(_application_action): |
814 | c308d73f | Stavros Sachtouris | """Cancel your application"""
|
815 | c308d73f | Stavros Sachtouris | action = 'cancel'
|
816 | c308d73f | Stavros Sachtouris | |
817 | c308d73f | Stavros Sachtouris | |
818 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
819 | c308d73f | Stavros Sachtouris | class project_membership(_init_synnefo_astakosclient): |
820 | c308d73f | Stavros Sachtouris | """Project membership management commands"""
|
821 | c308d73f | Stavros Sachtouris | |
822 | c308d73f | Stavros Sachtouris | |
823 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
824 | c308d73f | Stavros Sachtouris | class project_membership_list(_init_synnefo_astakosclient, _optional_json): |
825 | c308d73f | Stavros Sachtouris | """List all memberships"""
|
826 | c308d73f | Stavros Sachtouris | |
827 | c308d73f | Stavros Sachtouris | arguments = dict(
|
828 | c308d73f | Stavros Sachtouris | project=IntArgument('Filter by project id', '--with-project-id') |
829 | c308d73f | Stavros Sachtouris | ) |
830 | c308d73f | Stavros Sachtouris | |
831 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
832 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
833 | c308d73f | Stavros Sachtouris | def _run(self): |
834 | c308d73f | Stavros Sachtouris | self._print(self.client.get_memberships(self['project'])) |
835 | c308d73f | Stavros Sachtouris | |
836 | c308d73f | Stavros Sachtouris | def main(self): |
837 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
838 | c308d73f | Stavros Sachtouris | self._run()
|
839 | c308d73f | Stavros Sachtouris | |
840 | c308d73f | Stavros Sachtouris | |
841 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
842 | c308d73f | Stavros Sachtouris | class project_membership_info(_init_synnefo_astakosclient, _optional_json): |
843 | c308d73f | Stavros Sachtouris | """Details on a membership"""
|
844 | c308d73f | Stavros Sachtouris | |
845 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
846 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
847 | c308d73f | Stavros Sachtouris | def _run(self, memb_id): |
848 | c308d73f | Stavros Sachtouris | self._print(
|
849 | c308d73f | Stavros Sachtouris | self.client.get_membership(memb_id), self.print_dict) |
850 | c308d73f | Stavros Sachtouris | |
851 | c308d73f | Stavros Sachtouris | def main(self, membership_id): |
852 | c308d73f | Stavros Sachtouris | super(self.__class__, self)._run() |
853 | c308d73f | Stavros Sachtouris | self._run(membership_id)
|
854 | c308d73f | Stavros Sachtouris | |
855 | c308d73f | Stavros Sachtouris | |
856 | c308d73f | Stavros Sachtouris | class _membership_action(_init_synnefo_astakosclient, _optional_json): |
857 | c308d73f | Stavros Sachtouris | |
858 | c308d73f | Stavros Sachtouris | action = ''
|
859 | c308d73f | Stavros Sachtouris | |
860 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
861 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
862 | c308d73f | Stavros Sachtouris | def _run(self, memb_id, quote_a_reason): |
863 | c308d73f | Stavros Sachtouris | self._print(self.client.membership_action( |
864 | c308d73f | Stavros Sachtouris | memb_id, self.action, quote_a_reason))
|
865 | c308d73f | Stavros Sachtouris | |
866 | c308d73f | Stavros Sachtouris | def main(self, membership_id, quote_a_reason=''): |
867 | c308d73f | Stavros Sachtouris | super(_membership_action, self)._run() |
868 | c308d73f | Stavros Sachtouris | self._run(membership_id, quote_a_reason)
|
869 | c308d73f | Stavros Sachtouris | |
870 | c308d73f | Stavros Sachtouris | |
871 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
872 | c308d73f | Stavros Sachtouris | class project_membership_leave(_membership_action): |
873 | c308d73f | Stavros Sachtouris | """Leave a project you have membership to"""
|
874 | c308d73f | Stavros Sachtouris | action = 'leave'
|
875 | c308d73f | Stavros Sachtouris | |
876 | c308d73f | Stavros Sachtouris | |
877 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
878 | c308d73f | Stavros Sachtouris | class project_membership_cancel(_membership_action): |
879 | c308d73f | Stavros Sachtouris | """Cancel your (probably pending) membership to a project"""
|
880 | c308d73f | Stavros Sachtouris | action = 'cancel'
|
881 | c308d73f | Stavros Sachtouris | |
882 | c308d73f | Stavros Sachtouris | |
883 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
884 | c308d73f | Stavros Sachtouris | class project_membership_accept(_membership_action): |
885 | c308d73f | Stavros Sachtouris | """Accept a membership for a project you manage"""
|
886 | c308d73f | Stavros Sachtouris | action = 'accept'
|
887 | c308d73f | Stavros Sachtouris | |
888 | c308d73f | Stavros Sachtouris | |
889 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
890 | c308d73f | Stavros Sachtouris | class project_membership_reject(_membership_action): |
891 | c308d73f | Stavros Sachtouris | """Reject a membership for a project you manage"""
|
892 | c308d73f | Stavros Sachtouris | action = 'reject'
|
893 | c308d73f | Stavros Sachtouris | |
894 | c308d73f | Stavros Sachtouris | |
895 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
896 | c308d73f | Stavros Sachtouris | class project_membership_remove(_membership_action): |
897 | c308d73f | Stavros Sachtouris | """Remove a membership for a project you manage"""
|
898 | c308d73f | Stavros Sachtouris | action = 'remove'
|
899 | c308d73f | Stavros Sachtouris | |
900 | c308d73f | Stavros Sachtouris | |
901 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
902 | c308d73f | Stavros Sachtouris | class project_membership_join(_init_synnefo_astakosclient): |
903 | c308d73f | Stavros Sachtouris | """Join a project"""
|
904 | c308d73f | Stavros Sachtouris | |
905 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
906 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
907 | c308d73f | Stavros Sachtouris | def _run(self, project_id): |
908 | c308d73f | Stavros Sachtouris | self.writeln(self.client.join_project(project_id)) |
909 | c308d73f | Stavros Sachtouris | |
910 | c308d73f | Stavros Sachtouris | def main(self, project_id): |
911 | c308d73f | Stavros Sachtouris | super(project_membership_join, self)._run() |
912 | c308d73f | Stavros Sachtouris | self._run(project_id)
|
913 | c308d73f | Stavros Sachtouris | |
914 | c308d73f | Stavros Sachtouris | |
915 | c308d73f | Stavros Sachtouris | @command(project_commands)
|
916 | c308d73f | Stavros Sachtouris | class project_membership_enroll(_init_synnefo_astakosclient): |
917 | c308d73f | Stavros Sachtouris | """Enroll somebody to a project you manage"""
|
918 | c308d73f | Stavros Sachtouris | |
919 | c308d73f | Stavros Sachtouris | @errors.generic.all
|
920 | c308d73f | Stavros Sachtouris | @errors.user.astakosclient
|
921 | c308d73f | Stavros Sachtouris | def _run(self, project_id, email): |
922 | c308d73f | Stavros Sachtouris | self.writeln(self.client.enroll_member(project_id, email)) |
923 | c308d73f | Stavros Sachtouris | |
924 | c308d73f | Stavros Sachtouris | def main(self, project_id, email): |
925 | c308d73f | Stavros Sachtouris | super(project_membership_join, self)._run() |
926 | c308d73f | Stavros Sachtouris | self._run(project_id, email) |