Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Configure the TempDir where the API loads plugins. #1494

Closed
jtlisi opened this issue Jan 26, 2017 · 4 comments
Closed

Configure the TempDir where the API loads plugins. #1494

jtlisi opened this issue Jan 26, 2017 · 4 comments

Comments

@jtlisi
Copy link
Contributor

jtlisi commented Jan 26, 2017

One issue we are facing with loading plugins through the api is that the temporary directory which houses the temporary files is not configurable in snapteld's configuration.

I noticed on line 192 of mgmt/rest/v1/plugin.go
the function writeFile uses the the ioutil.TempDir function:

func writeFile(filename string, b []byte) (string, error) {
	// Create temporary directory
	dir, err := ioutil.TempDir("", "")
        ...

ioutil.TempDir defaults to the TMPDIR env variable or to /tmp directory if it is not set. I was hoping it could default to either a directory in /opt/snap/ or be configurable in the snapteld configuration.

Let me know what you guys think.

Thanks!

@kindermoumoute
Copy link
Contributor

kindermoumoute commented Jan 26, 2017

I like the idea and it would be trivial to implement a temps path in the query:

  • /v2/plugins?tmpPath=myTempPath

What do you think if we add this feature to the version 2 of the API? (writeFile in v2)

@jtlisi
Copy link
Contributor Author

jtlisi commented Jan 26, 2017

That would be perfect! this would be configurable in snaptel as a flag right?

@jtlisi
Copy link
Contributor Author

jtlisi commented Jan 26, 2017

@kindermoumoute Would this also work if a plugin is loaded through the tribe?

@kindermoumoute
Copy link
Contributor

AFAIK, yes.

However, Tribe is not implemented in v2 routes yet. The reason of that is Tribe is still beta, and we might have a different approach on the API for the next version.

That's why it will take some time before this feature work with Tribe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants