Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore dpkg files when running hook scripts #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ifupdown2/ifupdown/ifupdownmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,9 @@ def load_scripts(self, modules_dir):
try:
module_list = os.listdir(msubdir)
for module in module_list:
if self.modules.get(module) or module in self.overridden_ifupdown_scripts:
if (self.modules.get(module)
or module in self.overridden_ifupdown_scripts
or utils.is_dpkg_file(module)):
continue
self.script_ops[op].append(msubdir + '/' + module)
except Exception:
Expand Down
6 changes: 6 additions & 0 deletions ifupdown2/ifupdown/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ def strip_hwaddress(hwaddress):
# what we have in the cache (data retrieved via a netlink dump by
# nlmanager). nlmanager return all macs in lower-case

_dpkg_suffixes = (".dpkg-old", ".dpkg-dist", ".dpkg-new", ".dpkg-tmp")

@staticmethod
def is_dpkg_file(name):
return any(name.endswith(suffix) for suffix in utils._dpkg_suffixes)

@classmethod
def importName(cls, modulename, name):
""" Import a named object """
Expand Down