Skip to content

TypeError enumerating images a PreStdLogicalImageContainer #11

@gonmator

Description

@gonmator

A TypeError is raised when listing the content of a volume instance of a PreStdLogicalImageContainer. (For instance, calling the printLogicalImageInfo() function in aff4.py. The error I got:

TypeError: __init__() missing 1 required positional argument: 'pathName'

I found the issue is in container.LogicalImageContainer and container.PreStdLogicalImageContainer classes. While the method images() of the first class initialize correctly the LogicalImage instance to be yield:

yield aff4.LogicalImage(self, self.resolver, self.urn, image, pathName)

the method images() of PreStdLogicalImageContainer class and method open() of both classes missed to pass the container (self) as first parameter:

yield aff4.LogicalImage(self.resolver, self.urn, image, pathName)
...
return aff4.LogicalImage(self.resolver, self.urn, urn, pathName)

Initializer of aff4.LogicalImage expects the container as first parameter:

class LogicalImage(AFF4Object):
    def __init__(self, container, resolver, volume, urn, pathName):
        super(LogicalImage, self).__init__(resolver, urn)
        self.volume = volume
        self.pathName = pathName
        self.container = container

Just passing self as first parameter should solve the issue.

(I could prepare a pull request if needed, but I would like to have some guide about branch naming, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions