← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~ack/maas:no-setup-cfg-data-files into maas:master

 

Review: Approve

nit-picks inline

Diff comments:

> diff --git a/src/maastesting/fixtures.py b/src/maastesting/fixtures.py
> index b8a5073..07e4468 100644
> --- a/src/maastesting/fixtures.py
> +++ b/src/maastesting/fixtures.py
> @@ -282,34 +283,13 @@ class MAASRootFixture(fixtures.Fixture):
>      """
>  
>      def _setUp(self):
> -        skel = Path(dev_root).joinpath("run-skel")
> -        if skel.is_dir():
> -            self.path = self.useFixture(TempDirectory()).join("run")
> -            # Work only in `run`; reference the old $MAAS_ROOT.
> -            etc = Path(self.path).joinpath("etc")
> -            # Create and populate $MAAS_ROOT/run/etc/{chrony,c/chrony.conf}.
> -            # The `.keep` file is not strictly necessary, but it's created for
> -            # consistency with the source tree's `run` directory.
> -            ntp = etc.joinpath("chrony")
> -            ntp.mkdir(parents=True)
> -            ntp.joinpath(".keep").touch()
> -            ntp_conf = ntp.joinpath("chrony.conf")
> -            ntp_conf.write_bytes(
> -                skel.joinpath("etc", "chrony", "chrony.conf").read_bytes()
> -            )
> -            # Create and populate $MAAS_ROOT/run/etc/maas.
> -            maas = etc.joinpath("maas")
> -            maas.mkdir(parents=True)
> -            maas.joinpath("drivers.yaml").symlink_to(
> -                skel.joinpath("etc", "maas", "drivers.yaml").resolve()
> -            )
> -            maas.joinpath("templates").mkdir()
> -            # Update the environment.
> -            self.useFixture(EnvironmentVariable("MAAS_ROOT", self.path))
> -        else:
> -            raise NotADirectoryError(
> -                "Skeleton MAAS_ROOT (%s) is not a directory." % skel
> -            )
> +        self.path = self.useFixture(TempDirectory()).join("run")
> +        # copy all package files into the run dir
> +        repo_dir = Path(dev_root)
> +        copytree(repo_dir / "run-skel", self.path, dirs_exist_ok=True)
> +        copytree(repo_dir / "package-files", self.path, dirs_exist_ok=True)
> +        # Update the environment.

remove the useless comment?

> +        self.useFixture(EnvironmentVariable("MAAS_ROOT", self.path))
>  
>  
>  class MAASDataFixture(fixtures.Fixture):
> diff --git a/src/provisioningserver/utils/tests/test_fs.py b/src/provisioningserver/utils/tests/test_fs.py
> index ec7dcdc..ee834b0 100644
> --- a/src/provisioningserver/utils/tests/test_fs.py
> +++ b/src/provisioningserver/utils/tests/test_fs.py
> @@ -453,7 +453,9 @@ class TestGetLibraryScriptPath(MAASTestCase):
>          provisioningserver.config.is_dev_environment.return_value = True
>          script_name = factory.make_name("script")
>          self.assertEqual(
> -            dev_root.rstrip("/") + "/scripts/" + script_name,
> +            dev_root.rstrip("/")
> +            + "/package-files/usr/lib/maas/"
> +            + script_name,

this might work better as an f-string?

f"{dev_root}package-files/usr/lib/maas/{script_name}" ?

>              get_library_script_path(script_name),
>          )
>  


-- 
https://code.launchpad.net/~ack/maas/+git/maas/+merge/439798
Your team MAAS Committers is subscribed to branch maas:master.