Fail if stderr contains any "Fail", unless expect_error is True. Return (stderr, filename -> ConfigParser) pair with ouput to stderr and env[
'SYSTEMD_LOG_LEVEL'] =
'debug' env[
'SYSTEMD_LOG_TARGET'] =
'console' # for python3 we need here strict=False to parse multiple # lines with the same key # RawConfigParser in python2 does not have the strict option # but it allows multiple lines with the same key by default '''Create a SysV init script with the given keys in the LSB header There are sensible default values for all fields. If enable is True, links will be created in the rcN.d dirs. In that case, the priority can be given with "prio" (default to 1). Return path of generated script. keys.
setdefault(
'Description',
'long description for test %s service' %
f.
write(
'#%20s %s\n' % (k +
':', v))
f.
write(
'### END INIT INFO\ncode --goes here\n')
'''assert that a unit is enabled in precisely the given targets''' '%s unexpectedly exists' %
link)
'''simple service without dependencies, disabled''' # no enablement links or other stuff # $local_fs does not need translation, don't expect any dependency set([
'Documentation',
'SourcePath',
'Description']))
'''simple service without dependencies, enabled in all runlevels''' '''simple service without dependencies, that requires escaping the name''' '''simple service without dependencies, enabled in some runlevels''' '''single LSB macro dependency: $network''' set([
'Documentation',
'SourcePath',
'Description',
'After',
'Wants']))
'''multiple LSB macro dependencies''' set([
'Documentation',
'SourcePath',
'Description',
'After']))
'''LSB header dependencies to other services''' # also give symlink priorities here; they should be ignored 'Should-Start':
'may1 ne_may2'},
[
'foo.service',
'may1.service',
'must1.service',
'must2.service'])
# foo should depend on all of them [
'may1.service',
'must1.service',
'must2.service',
'ne_may2.service'])
# other services should not depend on each other '''script without LSB headers use rcN.d priority''' # create two init.d scripts without LSB header and enable them with for prio,
name in [(
10,
'provider'), (
15,
'consumer')]:
'''multiple Provides: names''' set([
'Documentation',
'SourcePath',
'Description']))
# should create symlinks for the alternative names for f
in [
'bar.service',
'baz.service']:
'''a script that Provides: a name that requires escaping''' '''multiple init.d scripts provide the same name''' # should create symlink for the alternative name for either unit [
'foo.service',
'bar.service'])
'''init.d scripts provides the name of another init.d script''' # we do expect an overwrite here, bar.service should overwrite the # alias link from foo.service '''ignores non-executable init.d script''' '''init.d script with .sh suffix''' # calls correct script with .sh '''init.d script with .sh suffix and Provides:''' # ensure we don't try to create a symlink to itself # should create symlink for the alternative name '''init.d script with hidden file suffix''' # backup files (not enabled in rcN.d/) '''init.d script with backup file''' # backup files (not enabled in rcN.d/) [
'foo.bak.service',
'foo.old.service',
'foo.service'])
# ensure we don't try to create a symlink to itself '''existing native unit''' # no enablement or alias links, as native unit is disabled