mock_compiled[mon.create_mon].side_effect = _create_mon
try:
- with mock.patch('socket.getaddrinfo', fake_getaddrinfo):
- with directory(str(tmpdir)):
- main(
- args=['-v', 'new', 'host1'],
- namespace=ns,
- )
- main(
- args=['-v', 'mon', 'create', 'host1'],
- namespace=ns,
- )
+ with mock.patch('ceph_deploy.new.socket.gethostbyname'):
+ with mock.patch('socket.getaddrinfo', fake_getaddrinfo):
+ with directory(str(tmpdir)):
+ main(
+ args=['-v', 'new', 'host1'],
+ namespace=ns,
+ )
+ main(
+ args=['-v', 'mon', 'create', 'host1'],
+ namespace=ns,
+ )
except SystemExit as e:
raise AssertionError('Unexpected exit: %s', e)
out, err = capsys.readouterr()
def test_write_global_conf_section(tmpdir, cli):
- with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
- with directory(str(tmpdir)):
- main(args=['new', 'host1'])
+ with patch('ceph_deploy.new.socket.gethostbyname'):
+ with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+ with directory(str(tmpdir)):
+ main(args=['new', 'host1'])
with tmpdir.join('ceph.conf').open() as f:
cfg = conf.parse(f)
assert cfg.sections() == ['global']
cli = request.getfuncargvalue('cli')
def new(*args):
- with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
- with directory(str(tmpdir)):
- main( args=['new'] + list(args))
- with tmpdir.join('ceph.conf').open() as f:
- cfg = conf.parse(f)
- return cfg
+ with patch('ceph_deploy.new.socket.gethostbyname'):
+ with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+ with directory(str(tmpdir)):
+ main( args=['new'] + list(args))
+ with tmpdir.join('ceph.conf').open() as f:
+ cfg = conf.parse(f)
+ return cfg
return new