Symlinks in juju-core

roger peppe roger.peppe at canonical.com
Thu Feb 7 19:03:02 UTC 2013


On 7 February 2013 18:08, John Arbash Meinel <john at arbash-meinel.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2013-02-07 21:56, roger peppe wrote:
>> ISTR adding the symlinks, and i'm pretty sure that was because some
>> things use the default series when deploying testing charms.
>>
>> maybe it's no longer true. i'd be happy to avoid all use of
>> symlinks in our code base.
>>
>> next up: appropriate use of path/filepath :-)
>
> So I think we need to do a little bit of supporting symlinks, because
> charms like to use them to create the same hook via a different name.
>
> However, we can minimize it outside of that part.
>
> In doing "grep -rnI 'Charms.[A-Z]'" I see exactly 1 place that doesn't
> pass exactly "series" to a testing.Charms function, and that is:
>
> environs/jujutest/livetests.go
>
> Which passes mtools0.Series. Which at first glance could matter,
> except all of those directories are symlinks anyway. And ClonedURL
> already is copying into a target directory. So we could just encode
> knowledge of that into Charms itself. So it copies to the temporary
> directory adding the requested series name.
>
> I'll put together a patch that just removes the outer symlinks and
> then updates testing.Charms to remove the series parameter for
> everything that we aren't actually making use of. (I'll leave the
> copy-a-new-one functions taking a series parameter which is the target
> series.)

that seems like a fine approach to me, assuming it works
(and currently i can think of no reason why it wouldn't).

obviously, ClonedURL will still need to take a series parameter.
but it can copy into the requested series directory and return
a URL that has the requested series, so everything *should*
just work.



More information about the Juju-dev mailing list