← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:cleanup/cii-cleanup into cloud-init:master

 

One more round on the @property structure, see inline.

Diff comments:

> diff --git a/tests/cloud_tests/images/lxd.py b/tests/cloud_tests/images/lxd.py
> index fd4e93c..fbd5196 100644
> --- a/tests/cloud_tests/images/lxd.py
> +++ b/tests/cloud_tests/images/lxd.py
> @@ -49,15 +49,19 @@ class LXDImage(base.Image):
>          self._pylxd_image = pylxd_image
>  
>      @property
> -    def instance(self):
> -        """Property function."""
> -        if not self._instance:
> -            self._instance = self.platform.launch_container(
> +    def _instance(self):
> +        """Internal use only, returns a instance

Then maybe just drop the @property; all the the callers used the internal name anyhow.
Also, you still have the internal method always call .start(); don't we only want to do that *once* 
for the modification?

> +
> +        This starts an lxc instance from the image, so it is "dirty".
> +        Better would be some way to modify this "at rest".
> +        lxc-pstart would be an option."""
> +        if not self._img_instance:
> +            self._img_instance = self.platform.launch_container(
>                  self.properties, self.config, self.features,
>                  use_desc='image-modification', image_desc=str(self),
>                  image=self.pylxd_image.fingerprint)
> -        self._instance.start()
> -        return self._instance
> +        self._img_instance.start()
> +        return self._img_instance
>  
>      @property
>      def properties(self):


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/333059
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:cleanup/cii-cleanup into cloud-init:master.


References