@@ -13,17 +13,19 @@ def provision(docker_platform, inventory_location, vars)
1313 include PuppetLitmus ::InventoryManipulation
1414 inventory_full_path = File . join ( inventory_location , '/spec/fixtures/litmus_inventory.yaml' )
1515 inventory_hash = get_inventory_hash ( inventory_full_path )
16+
17+ docker_run_opts = ''
1618 unless vars . nil?
1719 var_hash = YAML . safe_load ( vars )
1820 docker_run_opts = var_hash [ 'docker_run_opts' ] . flatten . join ( ' ' ) unless var_hash [ 'docker_run_opts' ] . nil?
1921 end
2022
21- deb_family_systemd_volume = if ( docker_platform =~ %r{debian|ubuntu} ) && ( docker_platform !~ %r{debian8|ubuntu14} )
22- ' --volume /sys/fs/cgroup:/sys/fs/cgroup:ro'
23- else
24- ''
25- end
26- creation_command = "docker run -d -it #{ deb_family_systemd_volume } --privileged #{ docker_run_opts } #{ docker_platform } "
23+ docker_run_opts += ' --volume /sys/fs/cgroup:/sys/fs/cgroup:rw' if ( docker_platform =~ %r{debian|ubuntu} ) \
24+ && ( docker_run_opts !~ %r{ --volume /sys/fs/cgroup:/sys/fs/cgroup} )
25+ docker_run_opts += ' --cgroupns=host' if ( docker_platform =~ %r{debian|ubuntu} ) \
26+ && ( docker_run_opts !~ %r{--cgroupns} )
27+
28+ creation_command = "docker run -d -it --privileged #{ docker_run_opts } #{ docker_platform } "
2729 container_id = run_local_command ( creation_command ) . strip [ 0 ..11 ]
2830 fix_missing_tty_error_message ( container_id ) unless platform_is_windows? ( docker_platform )
2931 node = { 'uri' => container_id ,
@@ -33,6 +35,7 @@ def provision(docker_platform, inventory_location, vars)
3335 var_hash = YAML . safe_load ( vars )
3436 node [ 'vars' ] = var_hash
3537 end
38+
3639 group_name = 'docker_nodes'
3740 add_node_to_group ( inventory_hash , node , group_name )
3841 File . open ( inventory_full_path , 'w' ) { |f | f . write inventory_hash . to_yaml }
0 commit comments