summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0377e37)
Fix result testing of is_symlink() to ignore negative results, which happen if
the file name does not exist at all. In this case we do not want a warning and
unlink the non-existing link.
https://bugs.debian.org/778700
/* We might already have a symlink with the same name from a Provides:,
* or from backup files like /etc/init.d/foo.bak. Real scripts always win,
* so remove an existing link */
/* We might already have a symlink with the same name from a Provides:,
* or from backup files like /etc/init.d/foo.bak. Real scripts always win,
* so remove an existing link */
- if (is_symlink(unit)) {
+ if (is_symlink(unit) > 0) {
log_warning("Overwriting existing symlink %s with real service", unit);
(void) unlink(unit);
}
log_warning("Overwriting existing symlink %s with real service", unit);
(void) unlink(unit);
}
self.assertEqual(s.get('Service', 'ExecStop'),
'%s stop' % init_script)
self.assertEqual(s.get('Service', 'ExecStop'),
'%s stop' % init_script)
+ self.assertNotIn('Overwriting', err)
+
def test_simple_enabled_all(self):
'''simple service without dependencies, enabled in all runlevels'''
def test_simple_enabled_all(self):
'''simple service without dependencies, enabled in all runlevels'''
err, results = self.run_generator()
self.assertEqual(list(results), ['foo.service'])
self.assert_enabled('foo.service', ['multi-user', 'graphical'])
err, results = self.run_generator()
self.assertEqual(list(results), ['foo.service'])
self.assert_enabled('foo.service', ['multi-user', 'graphical'])
+ self.assertNotIn('Overwriting', err)
def test_simple_enabled_some(self):
'''simple service without dependencies, enabled in some runlevels'''
def test_simple_enabled_some(self):
'''simple service without dependencies, enabled in some runlevels'''
for f in ['bar.service', 'baz.service']:
self.assertEqual(os.readlink(os.path.join(self.out_dir, f)),
'foo.service')
for f in ['bar.service', 'baz.service']:
self.assertEqual(os.readlink(os.path.join(self.out_dir, f)),
'foo.service')
+ self.assertNotIn('Overwriting', err)
def test_same_provides_in_multiple_scripts(self):
'''multiple init.d scripts provide the same name'''
def test_same_provides_in_multiple_scripts(self):
'''multiple init.d scripts provide the same name'''
self.add_sysv('bar', {'Provides': 'bar'}, enable=True)
err, results = self.run_generator()
self.assertEqual(sorted(results), ['bar.service', 'foo.service'])
self.add_sysv('bar', {'Provides': 'bar'}, enable=True)
err, results = self.run_generator()
self.assertEqual(sorted(results), ['bar.service', 'foo.service'])
+ # we do expect an overwrite here, bar.service should overwrite the
+ # alias link from foo.service
+ self.assertIn('Overwriting', err)
def test_nonexecutable_script(self):
'''ignores non-executable init.d script'''
def test_nonexecutable_script(self):
'''ignores non-executable init.d script'''