Skip to content

Resource is an abstract class, be clear about it #157

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

Merged
merged 1 commit into from
Oct 3, 2017
Merged
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
13 changes: 12 additions & 1 deletion iocage/lib/Resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# POSSIBILITY OF SUCH DAMAGE.
import typing
import os.path
import abc

import libzfs

Expand All @@ -41,7 +42,7 @@
import iocage.lib.Config.File # noqa: F401


class Resource:
class Resource(metaclass=abc.ABCMeta):
"""
iocage resource

Expand Down Expand Up @@ -124,6 +125,10 @@ def __init__(
elif dataset is not None:
self.dataset = dataset

@abc.abstractmethod
def destroy(self):
pass

@property
def pool(self) -> libzfs.ZFSPool:
return self.zfs.get_pool(self.dataset_name)
Expand Down Expand Up @@ -321,6 +326,9 @@ def __init__(
logger=logger
)

def destroy(self):
raise NotImplementedError("destroy unimplemented for DefaultResource")

def save(self) -> None:
self.write_config(self.config.user_data)

Expand Down Expand Up @@ -349,6 +357,9 @@ def __init__(

self.filters = filters

def destroy(self):
raise NotImplementedError("destroy unimplemented for ListableResource")

def __iter__(
self
) -> typing.Generator['iocage.lib.Resource.Resource', None, None]:
Expand Down