Skip to content

Commit

Permalink
Merge pull request juju#16713 from SimonRichardson/move-worker-intern…
Browse files Browse the repository at this point in the history
…al-package

juju#16713

The worker package should not be used from outside of juju/juju as it's very much implementation-specific. If we put it behind the internal package, we're very much stating that this should not be used outside of juju/juju.

If a project does need to use a worker we have options:

 1. Copy and paste the worker
 2. Move the worker to a shared package 

## Checklist

<!-- If an item is not applicable, use `~strikethrough~`. -->

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing

## QA steps

Just bootstrapping should be enough.

```
$ juju bootstrap lxd test --build-agent
```


## Links


**Jira card:** JUJU-XXX
  • Loading branch information
jujubot committed Dec 15, 2023
2 parents c46ae88 + cfb3824 commit 755798d
Show file tree
Hide file tree
Showing 1,317 changed files with 1,423 additions and 1,423 deletions.
2 changes: 1 addition & 1 deletion agent/addons/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/juju/juju/core/machinelock"
"github.com/juju/juju/core/presence"
"github.com/juju/juju/worker/introspection"
"github.com/juju/juju/internal/worker/introspection"
)

// MetricSink describes a way to unregister a model metrics collector. This
Expand Down
2 changes: 1 addition & 1 deletion agent/addons/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
gc "gopkg.in/check.v1"

"github.com/juju/juju/agent/addons"
"github.com/juju/juju/internal/worker/introspection"
coretesting "github.com/juju/juju/testing"
"github.com/juju/juju/worker/introspection"
)

type introspectionSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion agent/engine/housing.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/juju/worker/v3"
"github.com/juju/worker/v3/dependency"

"github.com/juju/juju/worker/fortress"
"github.com/juju/juju/internal/worker/fortress"
)

// Decorator creates copies of dependency.Manifolds with additional
Expand Down
2 changes: 1 addition & 1 deletion agent/engine/housing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
gc "gopkg.in/check.v1"

"github.com/juju/juju/agent/engine"
"github.com/juju/juju/internal/worker/fortress"
coretesting "github.com/juju/juju/testing"
"github.com/juju/juju/worker/fortress"
)

type HousingSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion agent/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/juju/version/v2"

"github.com/juju/juju/agent/tools"
jworker "github.com/juju/juju/worker"
jworker "github.com/juju/juju/internal/worker"
)

// Logger represents the logging methods used by this package.
Expand Down
2 changes: 1 addition & 1 deletion agent/errors/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
gc "gopkg.in/check.v1"

agenterrors "github.com/juju/juju/agent/errors"
"github.com/juju/juju/internal/worker"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/testing"
"github.com/juju/juju/worker"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion api/common/lifeflag/facade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
apitesting "github.com/juju/juju/api/base/testing"
"github.com/juju/juju/api/common/lifeflag"
"github.com/juju/juju/core/life"
"github.com/juju/juju/internal/worker"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/worker"
)

type FacadeSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion api/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (w *commonWatcher) commonLoop() {
}

var (
// ErrRestartArgent matches juju/juju/worker/error.go ErrRestartAgent
// ErrRestartArgent matches juju/juju/internal/worker/error.go ErrRestartAgent
// and is used to indicate that the watcher should be restarted.
ErrRestartAgent = errors.New("agent should be restarted")
)
Expand Down
6 changes: 3 additions & 3 deletions apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ import (
controllermsg "github.com/juju/juju/internal/pubsub/controller"
"github.com/juju/juju/internal/resource"
"github.com/juju/juju/internal/servicefactory"
"github.com/juju/juju/internal/worker/objectstore"
"github.com/juju/juju/internal/worker/syslogger"
"github.com/juju/juju/internal/worker/trace"
"github.com/juju/juju/rpc"
"github.com/juju/juju/rpc/jsoncodec"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/objectstore"
"github.com/juju/juju/worker/syslogger"
"github.com/juju/juju/worker/trace"
)

var logger = loggo.GetLogger("juju.apiserver")
Expand Down
4 changes: 2 additions & 2 deletions apiserver/common/unitstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/juju/charm/v12/hooks"

"github.com/juju/juju/core/status"
"github.com/juju/juju/internal/worker/uniter/hook"
"github.com/juju/juju/internal/worker/uniter/operation"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/uniter/hook"
"github.com/juju/juju/worker/uniter/operation"
)

// StatusAndErr pairs a StatusInfo with an error associated with
Expand Down
4 changes: 2 additions & 2 deletions apiserver/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"github.com/juju/juju/core/permission"
coretrace "github.com/juju/juju/core/trace"
"github.com/juju/juju/internal/servicefactory"
"github.com/juju/juju/internal/worker/objectstore"
"github.com/juju/juju/internal/worker/trace"
"github.com/juju/juju/rpc"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/objectstore"
"github.com/juju/juju/worker/trace"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/agent/secretsmanager/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
corelogger "github.com/juju/juju/core/logger"
coresecrets "github.com/juju/juju/core/secrets"
"github.com/juju/juju/internal/secrets/provider"
"github.com/juju/juju/internal/worker/apicaller"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/apicaller"
)

// Register is called to expose a package of facades onto a given registry.
Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/client/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ import (
"github.com/juju/juju/environs/config"
"github.com/juju/juju/internal/docker"
pscontroller "github.com/juju/juju/internal/pubsub/controller"
"github.com/juju/juju/internal/worker/multiwatcher"
jujujujutesting "github.com/juju/juju/juju/testing"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state"
statetesting "github.com/juju/juju/state/testing"
"github.com/juju/juju/testing"
"github.com/juju/juju/testing/factory"
"github.com/juju/juju/worker/multiwatcher"
)

type controllerSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion apiserver/logsink.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/logsink"
corelogger "github.com/juju/juju/core/logger"
"github.com/juju/juju/internal/worker/syslogger"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/syslogger"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions apiserver/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"github.com/juju/juju/core/presence"
"github.com/juju/juju/internal/pubsub/controller"
"github.com/juju/juju/internal/servicefactory"
"github.com/juju/juju/internal/worker/objectstore"
"github.com/juju/juju/internal/worker/trace"
"github.com/juju/juju/state"
"github.com/juju/juju/worker/objectstore"
"github.com/juju/juju/worker/trace"
)

// SharedHub represents the methods of the pubsub.StructuredHub
Expand Down
4 changes: 2 additions & 2 deletions apiserver/shared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
corecontroller "github.com/juju/juju/controller"
"github.com/juju/juju/core/presence"
"github.com/juju/juju/internal/pubsub/controller"
"github.com/juju/juju/internal/worker/lease"
"github.com/juju/juju/internal/worker/multiwatcher"
"github.com/juju/juju/state"
statetesting "github.com/juju/juju/state/testing"
"github.com/juju/juju/testing"
"github.com/juju/juju/worker/lease"
"github.com/juju/juju/worker/multiwatcher"
)

type sharedServerContextSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/containeragent/initialize/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/juju/juju/cmd/constants"
"github.com/juju/juju/cmd/containeragent/utils"
"github.com/juju/juju/internal/service/pebble/plan"
"github.com/juju/juju/worker/apicaller"
"github.com/juju/juju/worker/introspection"
"github.com/juju/juju/internal/worker/apicaller"
"github.com/juju/juju/internal/worker/introspection"
)

//go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/application_mock.go github.com/juju/juju/cmd/containeragent/initialize ApplicationAPI
Expand Down
6 changes: 3 additions & 3 deletions cmd/containeragent/initialize/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ func (*importSuite) TestImports(c *gc.C) {
"internal/service/systemd",
"internal/storage",
"internal/tools",
"internal/worker/apicaller",
"internal/worker/introspection",
"internal/worker/introspection/pprof",
"juju/osenv",
"provider/lxd/lxdnames",
"rpc",
"rpc/jsoncodec",
"rpc/params",
"state/errors",
"version",
"worker/apicaller",
"worker/introspection",
"worker/introspection/pprof",
)

unexpected := found.Difference(expected)
Expand Down
2 changes: 1 addition & 1 deletion cmd/containeragent/main_nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
"github.com/juju/juju/core/machinelock"
proxy "github.com/juju/juju/internal/proxy/config"
_ "github.com/juju/juju/internal/secrets/provider/all" // Import the secret providers.
"github.com/juju/juju/internal/worker/logsender"
"github.com/juju/juju/juju/names"
"github.com/juju/juju/juju/osenv"
"github.com/juju/juju/worker/logsender"
)

var logger = loggo.GetLogger("juju.cmd.containeragent")
Expand Down
8 changes: 4 additions & 4 deletions cmd/containeragent/unit/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ import (
"github.com/juju/juju/core/paths"
"github.com/juju/juju/internal/upgrade"
"github.com/juju/juju/internal/upgrades"
jworker "github.com/juju/juju/internal/worker"
"github.com/juju/juju/internal/worker/introspection"
"github.com/juju/juju/internal/worker/logsender"
uniterworker "github.com/juju/juju/internal/worker/uniter"
jnames "github.com/juju/juju/juju/names"
jujuversion "github.com/juju/juju/version"
jworker "github.com/juju/juju/worker"
"github.com/juju/juju/worker/introspection"
"github.com/juju/juju/worker/logsender"
uniterworker "github.com/juju/juju/worker/uniter"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/containeragent/unit/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"github.com/juju/juju/cmd/containeragent/unit"
utilsmocks "github.com/juju/juju/cmd/containeragent/utils/mocks"
"github.com/juju/juju/cmd/internal/agent/agentconf"
"github.com/juju/juju/internal/worker/logsender"
jnames "github.com/juju/juju/juju/names"
"github.com/juju/juju/testing"
coretesting "github.com/juju/juju/testing"
jujuversion "github.com/juju/juju/version"
"github.com/juju/juju/worker/logsender"
)

type containerUnitAgentSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/containeragent/unit/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/errors"
"github.com/juju/worker/v3/dependency"

"github.com/juju/juju/worker/lifeflag"
"github.com/juju/juju/internal/worker/lifeflag"
)

// ErrRemoved may be returned by some worker started from Manifolds to
Expand Down
2 changes: 1 addition & 1 deletion cmd/containeragent/unit/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
gc "gopkg.in/check.v1"

"github.com/juju/juju/cmd/containeragent/unit"
"github.com/juju/juju/worker/lifeflag"
"github.com/juju/juju/internal/worker/lifeflag"
)

type ErrorsSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/containeragent/unit/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/juju/juju/agent"
"github.com/juju/juju/cmd/containeragent/utils"
"github.com/juju/juju/cmd/internal/agent/agentconf"
"github.com/juju/juju/worker/logsender"
"github.com/juju/juju/internal/worker/logsender"
)

type (
Expand Down
50 changes: 25 additions & 25 deletions cmd/containeragent/unit/manifolds.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ import (
"github.com/juju/juju/internal/observability/probe"
proxy "github.com/juju/juju/internal/proxy/config"
"github.com/juju/juju/internal/upgrades"
jworker "github.com/juju/juju/worker"
"github.com/juju/juju/worker/agent"
"github.com/juju/juju/worker/apiaddressupdater"
"github.com/juju/juju/worker/apicaller"
"github.com/juju/juju/worker/apiconfigwatcher"
"github.com/juju/juju/worker/caasprober"
"github.com/juju/juju/worker/caasunitsmanager"
"github.com/juju/juju/worker/caasunitterminationworker"
"github.com/juju/juju/worker/caasupgrader"
"github.com/juju/juju/worker/fortress"
"github.com/juju/juju/worker/gate"
"github.com/juju/juju/worker/leadership"
"github.com/juju/juju/worker/lifeflag"
wlogger "github.com/juju/juju/worker/logger"
"github.com/juju/juju/worker/logsender"
"github.com/juju/juju/worker/migrationflag"
"github.com/juju/juju/worker/migrationminion"
"github.com/juju/juju/worker/muxhttpserver"
"github.com/juju/juju/worker/proxyupdater"
"github.com/juju/juju/worker/retrystrategy"
"github.com/juju/juju/worker/s3caller"
"github.com/juju/juju/worker/secretsdrainworker"
"github.com/juju/juju/worker/simplesignalhandler"
"github.com/juju/juju/worker/uniter"
"github.com/juju/juju/worker/upgradestepsmachine"
jworker "github.com/juju/juju/internal/worker"
"github.com/juju/juju/internal/worker/agent"
"github.com/juju/juju/internal/worker/apiaddressupdater"
"github.com/juju/juju/internal/worker/apicaller"
"github.com/juju/juju/internal/worker/apiconfigwatcher"
"github.com/juju/juju/internal/worker/caasprober"
"github.com/juju/juju/internal/worker/caasunitsmanager"
"github.com/juju/juju/internal/worker/caasunitterminationworker"
"github.com/juju/juju/internal/worker/caasupgrader"
"github.com/juju/juju/internal/worker/fortress"
"github.com/juju/juju/internal/worker/gate"
"github.com/juju/juju/internal/worker/leadership"
"github.com/juju/juju/internal/worker/lifeflag"
wlogger "github.com/juju/juju/internal/worker/logger"
"github.com/juju/juju/internal/worker/logsender"
"github.com/juju/juju/internal/worker/migrationflag"
"github.com/juju/juju/internal/worker/migrationminion"
"github.com/juju/juju/internal/worker/muxhttpserver"
"github.com/juju/juju/internal/worker/proxyupdater"
"github.com/juju/juju/internal/worker/retrystrategy"
"github.com/juju/juju/internal/worker/s3caller"
"github.com/juju/juju/internal/worker/secretsdrainworker"
"github.com/juju/juju/internal/worker/simplesignalhandler"
"github.com/juju/juju/internal/worker/uniter"
"github.com/juju/juju/internal/worker/upgradestepsmachine"
)

// manifoldsConfig allows specialisation of the result of Manifolds.
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/juju/juju/core/machinelock"
jujuos "github.com/juju/juju/core/os"
"github.com/juju/juju/core/paths"
"github.com/juju/juju/internal/worker/uniter"
"github.com/juju/juju/juju/sockets"
"github.com/juju/juju/worker/uniter"
)

var logger = loggo.GetLogger("juju.cmd.jujud.run")
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/run/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (

"github.com/juju/juju/agent/config"
"github.com/juju/juju/core/machinelock"
"github.com/juju/juju/internal/worker/uniter"
"github.com/juju/juju/juju/sockets"
"github.com/juju/juju/testing"
"github.com/juju/juju/worker/uniter"
)

type RunTestSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/commands/helptool.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
jujucmd "github.com/juju/juju/cmd"
"github.com/juju/juju/core/network"
"github.com/juju/juju/internal/storage"
"github.com/juju/juju/worker/uniter/runner/jujuc"
"github.com/juju/juju/internal/worker/uniter/runner/jujuc"
)

// dummyHookContext implements hooks.Context,
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/ssh/debughooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/juju/juju/cmd/modelcmd"
"github.com/juju/juju/core/model"
"github.com/juju/juju/internal/network/ssh"
unitdebug "github.com/juju/juju/worker/uniter/runner/debug"
unitdebug "github.com/juju/juju/internal/worker/uniter/runner/debug"
)

const usageDebugHooksExamples = `
Expand Down
2 changes: 1 addition & 1 deletion cmd/jujud/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/juju/juju/cmd/jujud/agent/agenttest"
"github.com/juju/juju/core/network"
imagetesting "github.com/juju/juju/environs/imagemetadata/testing"
"github.com/juju/juju/worker/proxyupdater"
"github.com/juju/juju/internal/worker/proxyupdater"
)

type acCreator func() (cmd.Command, agentconf.AgentConf)
Expand Down
2 changes: 1 addition & 1 deletion cmd/jujud/agent/agenttest/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ import (
"github.com/juju/juju/internal/mongo"
"github.com/juju/juju/internal/mongo/mongotest"
coretools "github.com/juju/juju/internal/tools"
"github.com/juju/juju/internal/worker/peergrouper"
"github.com/juju/juju/juju/testing"
"github.com/juju/juju/state"
"github.com/juju/juju/state/stateenvirons"
statetesting "github.com/juju/juju/state/testing"
coretesting "github.com/juju/juju/testing"
"github.com/juju/juju/worker/peergrouper"
)

// TODO (stickupkid): Remove this once we have a better way of using a logger
Expand Down
Loading

0 comments on commit 755798d

Please sign in to comment.