Conditions | 1 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
1 | #!/usr/bin/env python |
||
23 | def run(self): |
||
24 | """ |
||
25 | Ping the Duo Platorm. |
||
26 | |||
27 | Returns: An dict with info returned by Duo. |
||
28 | |||
29 | Raises: |
||
30 | RuntimeError: On Invalid keys. |
||
31 | """ |
||
32 | |||
33 | try: |
||
34 | ikey = self.config['auth']['ikey'] |
||
35 | skey = self.config['auth']['skey'] |
||
36 | host = self.config['auth']['host'] |
||
37 | except KeyError: |
||
38 | raise ValueError("Duo config not found in config.") |
||
39 | |||
40 | auth = duo_client.Auth(ikey=ikey, |
||
41 | skey=skey, |
||
42 | host=host) |
||
43 | |||
44 | try: |
||
45 | data = auth.check() |
||
46 | except RuntimeError, e: |
||
47 | print e |
||
48 | raise RuntimeError("Check failed! '%s'" % e) |
||
49 | else: |
||
50 | return data |
||
51 |