-import pytest
from mock import patch
import re
import subprocess
def test_write_global_conf_section(tmpdir, cli):
- with patch('ceph_deploy.new.socket.gethostbyname'):
- with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+ with patch('ceph_deploy.new.net.get_nonlocal_ip', lambda x: '10.0.0.1'):
+ with patch('ceph_deploy.new.arg_validators.Hostname', lambda: lambda x: x):
with directory(str(tmpdir)):
main(args=['new', 'host1'])
with tmpdir.join('ceph.conf').open() as f:
- cfg = conf.parse(f)
+ cfg = conf.ceph.parse(f)
assert cfg.sections() == ['global']
cli = request.getfuncargvalue('cli')
def new(*args):
- with patch('ceph_deploy.new.socket.gethostbyname'):
- with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+ with patch('ceph_deploy.new.net.get_nonlocal_ip', lambda x: '10.0.0.1'):
+ with patch('ceph_deploy.new.arg_validators.Hostname', lambda: lambda x: x):
with directory(str(tmpdir)):
main( args=['new'] + list(args))
with tmpdir.join('ceph.conf').open() as f:
- cfg = conf.parse(f)
+ cfg = conf.ceph.parse(f)
return cfg
return new