Ensure we have short hostnames throughout, for consistency between remote.shortname and socket.gethostname() in cephadm.
(ctx)
| 117 | |
| 118 | @contextlib.contextmanager |
| 119 | def normalize_hostnames(ctx): |
| 120 | """ |
| 121 | Ensure we have short hostnames throughout, for consistency between |
| 122 | remote.shortname and socket.gethostname() in cephadm. |
| 123 | """ |
| 124 | log.info('Normalizing hostnames...') |
| 125 | cluster = ctx.cluster.filter(lambda r: '.' in r.hostname) |
| 126 | cluster.run(args=[ |
| 127 | 'sudo', |
| 128 | 'hostname', |
| 129 | run.Raw('$(hostname -s)'), |
| 130 | ]) |
| 131 | |
| 132 | try: |
| 133 | yield |
| 134 | finally: |
| 135 | pass |
| 136 | |
| 137 | |
| 138 | @contextlib.contextmanager |