Add /etc/hosts and /etc/nsswitch.conf to the bubblewrap

This change adds dns resolution helpers to the bubblewrap so that
hosts locally defined are resolvable in executor playbooks.

Change-Id: I5efad8749ff25cdbe6a142f9616422d96b7bbf33
This commit is contained in:
Tristan Cacqueray 2017-07-13 06:08:44 +00:00
parent e391ec8df8
commit a19e8c57c7
1 changed files with 4 additions and 0 deletions

View File

@ -150,6 +150,7 @@ class BubblewrapDriver(Driver, WrapperInterface):
'--ro-bind', '/bin', '/bin',
'--ro-bind', '/sbin', '/sbin',
'--ro-bind', '/etc/resolv.conf', '/etc/resolv.conf',
'--ro-bind', '/etc/hosts', '/etc/hosts',
'--ro-bind', '{ssh_auth_sock}', '{ssh_auth_sock}',
'--dir', '{work_dir}',
'--bind', '{work_dir}', '{work_dir}',
@ -166,6 +167,9 @@ class BubblewrapDriver(Driver, WrapperInterface):
if os.path.isdir('/lib64'):
bwrap_command.extend(['--ro-bind', '/lib64', '/lib64'])
if os.path.isfile('/etc/nsswitch.conf'):
bwrap_command.extend(['--ro-bind', '/etc/nsswitch.conf',
'/etc/nsswitch.conf'])
return bwrap_command