Skip to content

Commit

Permalink
Update to the latest names/v5 depedency
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRichardson committed Jan 9, 2024
1 parent 5a4632b commit 6fbb8a5
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 97 deletions.
9 changes: 8 additions & 1 deletion apiserver/facades/client/charms/services/repofactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ type LoggerFactory interface {
ForNamespace(string) LoggerFactory
}

// Logger is the interface that is used to log messages.
type Logger interface {
Errorf(string, ...interface{})
Warningf(string, ...interface{})
Debugf(string, ...interface{})
Tracef(string, ...interface{})
}

// CharmRepoFactoryConfig encapsulates the information required for creating a
// new CharmRepoFactory instance.
type CharmRepoFactoryConfig struct {
Expand All @@ -43,7 +51,6 @@ type CharmRepoFactoryConfig struct {
// calls.
type CharmRepoFactory struct {
loggerFactory LoggerFactory
logger charmhub.Logger
charmhubHTTPClient charmhub.HTTPClient
stateBackend StateBackend
modelBackend ModelBackend
Expand Down
36 changes: 20 additions & 16 deletions cmd/jujud/agent/machine/manifolds.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,16 @@ func IAASManifolds(config ManifoldsConfig) dependency.Manifolds {
manifolds := dependency.Manifolds{
// Bootstrap worker is responsible for setting up the initial machine.
bootstrapName: ifDatabaseUpgradeComplete(bootstrap.Manifold(bootstrap.ManifoldConfig{
AgentName: agentName,
StateName: stateName,
ObjectStoreName: objectStoreName,
ServiceFactoryName: serviceFactoryName,
BootstrapGateName: isBootstrapGateName,
AgentBinaryUploader: bootstrap.IAASAgentBinaryUploader,
RequiresBootstrap: bootstrap.RequiresBootstrap,
Logger: loggo.GetLogger("juju.worker.bootstrap"),
AgentName: agentName,
StateName: stateName,
ObjectStoreName: objectStoreName,
ServiceFactoryName: serviceFactoryName,
BootstrapGateName: isBootstrapGateName,
CharmhubHTTPClientName: charmhubHTTPClientName,
AgentBinaryUploader: bootstrap.IAASAgentBinaryUploader,
ControllerCharmUploader: bootstrap.ControllerCharmUploader,
RequiresBootstrap: bootstrap.RequiresBootstrap,
Logger: loggo.GetLogger("juju.worker.bootstrap"),
})),

toolsVersionCheckerName: ifNotMigrating(toolsversionchecker.Manifold(toolsversionchecker.ManifoldConfig{
Expand Down Expand Up @@ -1055,14 +1057,16 @@ func CAASManifolds(config ManifoldsConfig) dependency.Manifolds {
return mergeManifolds(config, dependency.Manifolds{
// Bootstrap worker is responsible for setting up the initial machine.
bootstrapName: ifDatabaseUpgradeComplete(bootstrap.Manifold(bootstrap.ManifoldConfig{
AgentName: agentName,
StateName: stateName,
ObjectStoreName: objectStoreName,
ServiceFactoryName: serviceFactoryName,
BootstrapGateName: isBootstrapGateName,
AgentBinaryUploader: bootstrap.CAASAgentBinaryUploader,
RequiresBootstrap: bootstrap.RequiresBootstrap,
Logger: loggo.GetLogger("juju.worker.bootstrap"),
AgentName: agentName,
StateName: stateName,
ObjectStoreName: objectStoreName,
ServiceFactoryName: serviceFactoryName,
BootstrapGateName: isBootstrapGateName,
CharmhubHTTPClientName: charmhubHTTPClientName,
AgentBinaryUploader: bootstrap.CAASAgentBinaryUploader,
ControllerCharmUploader: bootstrap.ControllerCharmUploader,
RequiresBootstrap: bootstrap.RequiresBootstrap,
Logger: loggo.GetLogger("juju.worker.bootstrap"),
})),

// TODO(caas) - when we support HA, only want this on primary
Expand Down
2 changes: 2 additions & 0 deletions cmd/jujud/agent/machine/manifolds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ var expectedMachineManifoldsWithDependenciesIAAS = map[string][]string{
"bootstrap": {
"agent",
"change-stream",
"charmhub-http-client",
"db-accessor",
"file-notify-watcher",
"is-bootstrap-gate",
Expand Down Expand Up @@ -1263,6 +1264,7 @@ var expectedMachineManifoldsWithDependenciesCAAS = map[string][]string{
"bootstrap": {
"agent",
"change-stream",
"charmhub-http-client",
"db-accessor",
"file-notify-watcher",
"is-bootstrap-gate",
Expand Down
13 changes: 8 additions & 5 deletions core/base/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ type Base struct {
Channel Channel
}

// Empty is an empty base.
var Empty = Base{}

// ParseBase constructs a Base from the os and channel string.
func ParseBase(os string, channel string) (Base, error) {
if os == "" && channel == "" {
return Base{}, nil
return Empty, nil
}
if os == "" || channel == "" {
return Base{}, errors.NotValidf("missing base os or channel")
return Empty, errors.NotValidf("missing base os or channel")
}
ch, err := ParseChannelNormalize(channel)
if err != nil {
return Base{}, errors.Annotatef(err, "parsing base %s@%s", os, channel)
return Empty, errors.Annotatef(err, "parsing base %s@%s", os, channel)
}
return Base{OS: strings.ToLower(os), Channel: ch}, nil
}
Expand All @@ -41,11 +44,11 @@ func ParseBase(os string, channel string) (Base, error) {
func ParseBaseFromString(b string) (Base, error) {
parts := strings.Split(b, "@")
if len(parts) != 2 {
return Base{}, errors.New("expected base string to contain os and channel separated by '@'")
return Empty, errors.New("expected base string to contain os and channel separated by '@'")
}
channel, err := ParseChannelNormalize(parts[1])
if err != nil {
return Base{}, errors.Trace(err)
return Empty, errors.Trace(err)
}
return Base{OS: parts[0], Channel: channel}, nil
}
Expand Down
67 changes: 37 additions & 30 deletions internal/bootstrap/bootstrap_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6fbb8a5

Please sign in to comment.