voxpupuli / puppet-systemd

Puppet module to manage systemd
https://forge.puppet.com/puppet/systemd
Apache License 2.0
52 stars 142 forks source link

Add `NetworkNamespacePath` to unit service #440

Closed supun983 closed 3 months ago

supun983 commented 3 months ago

Could you please check of adding NetworkNamespacePath key for the service section of a unit file(types/unit/service)

systemd ref: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#NetworkNamespacePath=

Valantin commented 3 months ago

Have you try

systemd::manage_unit { 'myrunner.service':
  unit_entry    => {
    'Description' => 'My great service',
  },
  service_entry => {
    'Type'      => 'oneshot',
    'ExecStart' => '/usr/bin/doit.sh',
    'NetworkNamespacePath' => '/path/to/',
  },
  install_entry => {
    'WantedBy' => 'multi-user.target',
  },
  enable        => true,
  active        => true,
}
supun983 commented 3 months ago

Have you try

systemd::manage_unit { 'myrunner.service':
  unit_entry    => {
    'Description' => 'My great service',
  },
  service_entry => {
    'Type'      => 'oneshot',
    'ExecStart' => '/usr/bin/doit.sh',
    'NetworkNamespacePath' => '/path/to/',
  },
  install_entry => {
    'WantedBy' => 'multi-user.target',
  },
  enable        => true,
  active        => true,
}

Yes, I tried like this. However, getting Evaluation Error as unrecognized key NetworkNamespacePath. To resolve it, need to define a key in Systemd::Unit::Service as Optional['NetworkNamespacePath'] => Variant[Stdlib::Unixpath,Array[Stdlib::Unixpath,1]].

Valantin commented 3 months ago

Ok I see let me try.

Valantin commented 3 months ago

Ok, I've set it as stdlib::unixpath instead of variant