コード例 #1
0
ファイル: example.py プロジェクト: Sukelluskello/MIDAS
 def check_key_executable(self, key):
     """
     Log the values of the launch agent/daemon keys in self.check_keys_hash
     """
     value = get_plist_key(self.plist_file, key)
     if value:
         try:
             if type(value) in [str, unicode]:
                 # This should only get triggered by the Program key
                 self.data[key.lower()] = str(to_ascii(value))
                 self.data["%s_hash" % key.lower()] = hash_file(
                     str(to_ascii(value))
                 )
             elif type(value) in [list]:
                 # This should only get triggered by the
                 # ProgramArguments key
                 self.data[key.lower()] = encode(" ".join(value))
                 self.data["%s_hash" % key.lower()] = hash_file(
                     str(value[0])
                 )
         except IOError:
             self.data["%s_hash" % key.lower()] = "File DNE"
     else:
         self.data[key.lower()] = "KEY DNE"
         self.data["%s_hash" % key.lower()] = "KEY DNE"
コード例 #2
0
    def check_key_executable(self, key):
        """
        Log the values of the launch agent/daemon keys in self.check_keys_hash
        """
        key = key.lower()
        key_hash = "%s_hash" % (key.lower(), )

        value = get_plist_key(self.plist_file, key)
        if value:
            try:
                if isinstance(value, basestring):
                    # This should only get triggered by the Program key
                    self.data[key] = str(to_ascii(value))
                    self.data[key_hash] = hash_file(str(to_ascii(value)))
                elif isinstance(value, (list, tuple)):
                    # This should only get triggered by the
                    # ProgramArguments key
                    self.data[key] = encode(" ".join(value))
                    self.data[key_hash] = hash_file(str(value[0]))
            except IOError:
                self.data[key_hash] = "File DNE"
        else:
            self.data[key] = "KEY DNE"
            self.data[key_hash] = "KEY DNE"
コード例 #3
0
ファイル: example.py プロジェクト: RyanFrantz/MIDAS
    def check_key_executable(self, key):
        """
        Log the values of the launch agent/daemon keys in self.check_keys_hash
        """
        key = key.lower()
        key_hash = "%s_hash" % (key.lower(), )

        value = get_plist_key(self.plist_file, key)
        if value:
            try:
                if isinstance(value, basestring):
                    # This should only get triggered by the Program key
                    self.data[key] = str(to_ascii(value))
                    self.data[key_hash] = hash_file(str(to_ascii(value)))
                elif isinstance(value, (list, tuple)):
                    # This should only get triggered by the
                    # ProgramArguments key
                    self.data[key] = encode(" ".join(value))
                    self.data[key_hash] = hash_file(str(value[0]))
            except IOError:
                self.data[key_hash] = "File DNE"
        else:
            self.data[key] = "KEY DNE"
            self.data[key_hash] = "KEY DNE"