MCPcopy Create free account
hub / github.com/ceph/ceph / normalize_hostnames

Function normalize_hostnames

qa/tasks/cephadm.py:119–135  ·  view source on GitHub ↗

Ensure we have short hostnames throughout, for consistency between remote.shortname and socket.gethostname() in cephadm.

(ctx)

Source from the content-addressed store, hash-verified

117
118@contextlib.contextmanager
119def 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

Callers 1

taskFunction · 0.85

Calls 3

infoMethod · 0.45
filterMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected