Fix fix_acpid syspep
authorNikos Skalkotos <skalkoto@grnet.gr>
Wed, 29 Aug 2012 09:07:23 +0000 (12:07 +0300)
committerNikos Skalkotos <skalkoto@grnet.gr>
Wed, 29 Aug 2012 09:07:23 +0000 (12:07 +0300)
Extend the mechanism to recognise events with value "button/power.*"
as power button events. It used to only check for events with value
"button[ /]power".

image_creator/os_type/linux.py

index 91f6910..fd45152 100644 (file)
@@ -91,7 +91,7 @@ class Linux(Unix):
                     action = m.group(1)
                     continue
 
                     action = m.group(1)
                     continue
 
-            if event.strip() == "button[ /]power":
+            if event.strip() in ("button[ /]power", "button/power.*"):
                 if action:
                     if not self.g.is_file(action):
                         self.out.warn("Acpid action file: %s does not exist" %
                 if action:
                     if not self.g.is_file(action):
                         self.out.warn("Acpid action file: %s does not exist" %
@@ -114,6 +114,8 @@ class Linux(Unix):
                               action.strip().split()[0])
                 return
 
                               action.strip().split()[0])
                 return
 
+        self.out.warn("No acpi power button event found!")
+
     @sysprep()
     def remove_persistent_net_rules(self, print_header=True):
         """Remove udev rules that will keep network interface names persistent
     @sysprep()
     def remove_persistent_net_rules(self, print_header=True):
         """Remove udev rules that will keep network interface names persistent