Revision 5ce3ce4f snf-astakos-app/astakos/im/management/commands/service_renew_token.py
b/snf-astakos-app/astakos/im/management/commands/service_renew_token.py | ||
---|---|---|
35 | 35 |
|
36 | 36 |
from astakos.im.models import Service |
37 | 37 |
|
38 |
|
|
38 | 39 |
class Command(BaseCommand): |
39 | 40 |
args = "<name>" |
40 | 41 |
help = "Renew service token" |
41 |
|
|
42 |
|
|
42 | 43 |
def handle(self, *args, **options): |
43 | 44 |
if len(args) != 1: |
44 | 45 |
raise CommandError("Invalid number of arguments") |
45 |
|
|
46 |
|
|
46 | 47 |
try: |
47 | 48 |
service = Service.objects.get(name=args[0]) |
48 | 49 |
service.renew_token() |
... | ... | |
51 | 52 |
except Service.DoesNotExist: |
52 | 53 |
raise CommandError("Invalid service name") |
53 | 54 |
except Exception, e: |
54 |
raise CommandError(e) |
|
55 |
raise CommandError(e) |
Also available in: Unified diff