Skip to content
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

feat(daemon): daemon access for API extensions #293

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

flotter
Copy link
Contributor

@flotter flotter commented Aug 31, 2023

The following PR provided Pebble derived projects to extend the supplied daemon HTTP API handlers.

#265

However, currently such a handler cannot access the daemon, even though we added a daemon method to also expose the Overlord.

func v1PostDevice(*daemon.Command, req *http.Request, _ *daemon.UserState) daemon.Response {
	:

	// Cannot access c.d (daemon is private)
        ovld := c.d.Overlord()

	:
}

This PR adds c.Daemon() to allow access inside externally defined HTTP API handlers.

The following PR provided Pebble derived projects to extend the supplied
daemon HTTP API handlers.

canonical#265

However, currently such a handler cannot access the daemon, even though we
added a daemon method to also expose the Overlord.

func v1PostDevice(
	*daemon.Command,
	req *http.Request,
	_ *daemon.UserState) daemon.Response {

	:

	// Cannot access c.d (daemon is private)
        ovld := c.d.Overlord()

	:
}

This PR adds c.Daemon() to allow access inside externally defined HTTP API
handlers.
@flotter
Copy link
Contributor Author

flotter commented Aug 31, 2023

I think this was most likely just an oversight at the time, but please let me know if I am missing something obvious where.

Copy link
Contributor

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, definitely seems necessary for external HTTP handlers to me.

@niemeyer niemeyer merged commit 6c07a1f into canonical:master Aug 31, 2023
13 checks passed
@benhoyt benhoyt mentioned this pull request Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants