Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 #-*- python -*- | 2 #-*- python -*- |
3 | 3 |
4 import socket | 4 import socket |
5 from charmhelpers import ( | 5 from charmhelpers import ( |
6 get_config, | 6 get_config, |
7 relation_set, | 7 relation_set, |
8 ) | 8 ) |
9 | 9 from utils import log_hook |
benji
2013/04/27 20:29:30
Unnecessary newline.
gary.poster
2013/04/28 01:48:15
I was doing as the Romans do, but eh, I don't thin
| |
10 from utils import ( | |
11 log_hook, | |
benji
2013/04/27 20:29:30
You can use a one-liner here.
gary.poster
2013/04/28 01:48:15
Again, I was following the local patterns in the c
| |
12 ) | |
13 | 10 |
14 | 11 |
15 def main(): | 12 def main(): |
16 hostname = socket.getfqdn(socket.gethostname()) | 13 hostname = socket.getfqdn() |
17 if hostname == "localhost": | |
18 hostname = socket.gethostname() | |
benji
2013/04/27 20:29:30
I'm pretty sure lines 16-18 are equivalent to
hos
gary.poster
2013/04/28 01:48:15
I stared at this for a bit. I think you are proba
| |
19 config = get_config() | 14 config = get_config() |
20 if config['secure']: | 15 if config['secure']: |
21 port = 443 | 16 port = 443 |
22 else: | 17 else: |
23 port = 80 | 18 port = 80 |
24 relation_set(port=port, hostname=hostname) | 19 relation_set(port=port, hostname=hostname) |
25 | 20 |
26 if __name__ == '__main__': | 21 if __name__ == '__main__': |
27 with log_hook(): | 22 with log_hook(): |
28 main() | 23 main() |
LEFT | RIGHT |