Skip to content

Commit ca040b8

Browse files
feat: remove branches/generations
This removes branches/generations. This was never fully realised and was always behind a feature flag. It was decided to remove this and tackle it once the dqlite was done. The approach is to leave the params/facades with the branch name and just set it to an empty string. The underlying data/persistence model will change now we're moving to dqlite.
1 parent e472454 commit ca040b8

File tree

120 files changed

+287
-8659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+287
-8659
lines changed

api/client/application/client.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,9 @@ func (c *Client) Deploy(args DeployArgs) error {
190190
// given application is running at present.
191191
// The charm origin gives more information about the location of the charm and
192192
// what revision/channel it came from.
193-
func (c *Client) GetCharmURLOrigin(branchName, applicationName string) (*charm.URL, apicharm.Origin, error) {
193+
func (c *Client) GetCharmURLOrigin(applicationName string) (*charm.URL, apicharm.Origin, error) {
194194
args := params.ApplicationGet{
195195
ApplicationName: applicationName,
196-
BranchName: branchName,
197196
}
198197

199198
var result params.CharmURLOriginResult
@@ -215,10 +214,10 @@ func (c *Client) GetCharmURLOrigin(branchName, applicationName string) (*charm.U
215214
// GetConfig returns the charm configuration settings for each of the
216215
// applications. If any of the applications are not found, an error is
217216
// returned.
218-
func (c *Client) GetConfig(branchName string, appNames ...string) ([]map[string]interface{}, error) {
217+
func (c *Client) GetConfig(appNames ...string) ([]map[string]interface{}, error) {
219218
arg := params.ApplicationGetArgs{Args: make([]params.ApplicationGet, len(appNames))}
220219
for i, appName := range appNames {
221-
arg.Args[i] = params.ApplicationGet{ApplicationName: appName, BranchName: branchName}
220+
arg.Args[i] = params.ApplicationGet{ApplicationName: appName}
222221
}
223222

224223
var results params.ApplicationGetConfigResults
@@ -300,7 +299,7 @@ type SetCharmConfig struct {
300299
}
301300

302301
// SetCharm sets the charm for a given application.
303-
func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error {
302+
func (c *Client) SetCharm(cfg SetCharmConfig) error {
304303
var storageDirectives map[string]params.StorageDirectives
305304
if len(cfg.StorageDirectives) > 0 {
306305
storageDirectives = make(map[string]params.StorageDirectives)
@@ -337,7 +336,6 @@ func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error {
337336
ResourceIDs: cfg.ResourceIDs,
338337
StorageDirectives: storageDirectives,
339338
EndpointBindings: cfg.EndpointBindings,
340-
Generation: branchName,
341339
}
342340
return c.facade.FacadeCall(context.TODO(), "SetCharm", args, nil)
343341
}
@@ -684,11 +682,10 @@ func (c *Client) Unexpose(application string, endpoints []string) error {
684682
}
685683

686684
// Get returns the configuration for the named application.
687-
func (c *Client) Get(branchName, application string) (*params.ApplicationGetResults, error) {
685+
func (c *Client) Get(application string) (*params.ApplicationGetResults, error) {
688686
var results params.ApplicationGetResults
689687
args := params.ApplicationGet{
690688
ApplicationName: application,
691-
BranchName: branchName,
692689
}
693690
err := c.facade.FacadeCall(context.TODO(), "Get", args, &results)
694691
return &results, err
@@ -799,11 +796,10 @@ func (c *Client) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error)
799796
}
800797

801798
// SetConfig sets configuration options on an application and the charm.
802-
func (c *Client) SetConfig(branchName, application, configYAML string, config map[string]string) error {
799+
func (c *Client) SetConfig(application, configYAML string, config map[string]string) error {
803800
args := params.ConfigSetArgs{
804801
Args: []params.ConfigSet{{
805802
ApplicationName: application,
806-
Generation: branchName,
807803
Config: config,
808804
ConfigYAML: configYAML,
809805
}},
@@ -817,11 +813,10 @@ func (c *Client) SetConfig(branchName, application, configYAML string, config ma
817813
}
818814

819815
// UnsetApplicationConfig resets configuration options on an application.
820-
func (c *Client) UnsetApplicationConfig(branchName, application string, options []string) error {
816+
func (c *Client) UnsetApplicationConfig(application string, options []string) error {
821817
args := params.ApplicationConfigUnsetArgs{
822818
Args: []params.ApplicationUnset{{
823819
ApplicationName: application,
824-
BranchName: branchName,
825820
Options: options,
826821
}},
827822
}

api/client/application/client_test.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import (
2727
"github.com/juju/juju/rpc/params"
2828
)
2929

30-
const newBranchName = "new-branch"
31-
3230
type applicationSuite struct{}
3331

3432
var _ = gc.Suite(&applicationSuite{})
@@ -207,13 +205,12 @@ func (s *applicationSuite) TestApplicationGetCharmURLOrigin(c *gc.C) {
207205
}
208206
args := params.ApplicationGet{
209207
ApplicationName: "application",
210-
BranchName: newBranchName,
211208
}
212209
mockFacadeCaller := mocks.NewMockFacadeCaller(ctrl)
213210
mockFacadeCaller.EXPECT().FacadeCall(gomock.Any(), "GetCharmURLOrigin", args, result).SetArg(3, results).Return(nil)
214211
client := application.NewClientFromCaller(mockFacadeCaller)
215212

216-
curl, origin, err := client.GetCharmURLOrigin(newBranchName, "application")
213+
curl, origin, err := client.GetCharmURLOrigin("application")
217214
c.Assert(err, jc.ErrorIsNil)
218215
c.Assert(curl, gc.DeepEquals, charm.MustParseURL("ch:curl"))
219216
c.Assert(origin, gc.DeepEquals, apicharm.Origin{
@@ -250,7 +247,6 @@ func (s *applicationSuite) TestSetCharm(c *gc.C) {
250247
"b": {Count: toUint64Ptr(123)},
251248
"c": {Size: toUint64Ptr(123)},
252249
},
253-
Generation: newBranchName,
254250
}
255251

256252
c.Assert(args.ConfigSettingsYAML, gc.Equals, "yaml")
@@ -290,7 +286,7 @@ func (s *applicationSuite) TestSetCharm(c *gc.C) {
290286
mockFacadeCaller.EXPECT().FacadeCall(gomock.Any(), "SetCharm", args, nil).Return(nil)
291287

292288
client := application.NewClientFromCaller(mockFacadeCaller)
293-
err := client.SetCharm(newBranchName, cfg)
289+
err := client.SetCharm(cfg)
294290
c.Assert(err, jc.ErrorIsNil)
295291
}
296292

@@ -309,7 +305,7 @@ func (s *applicationSuite) TestDestroyApplications(c *gc.C) {
309305
}}
310306
delay := 1 * time.Minute
311307
result := new(params.DestroyApplicationResults)
312-
results := params.DestroyApplicationResults{expectedResults}
308+
results := params.DestroyApplicationResults{Results: expectedResults}
313309
args := params.DestroyApplicationsParams{
314310
Applications: []params.DestroyApplicationParams{
315311
{ApplicationTag: "application-foo", Force: true, MaxWait: &delay},
@@ -713,8 +709,8 @@ func (s *applicationSuite) TestGetConfig(c *gc.C) {
713709
defer ctrl.Finish()
714710

715711
args := params.ApplicationGetArgs{Args: []params.ApplicationGet{
716-
{ApplicationName: "foo", BranchName: newBranchName},
717-
{ApplicationName: "bar", BranchName: newBranchName},
712+
{ApplicationName: "foo"},
713+
{ApplicationName: "bar"},
718714
}}
719715
fooConfig := map[string]interface{}{
720716
"outlook": map[string]interface{}{
@@ -754,7 +750,7 @@ func (s *applicationSuite) TestGetConfig(c *gc.C) {
754750
mockFacadeCaller.EXPECT().FacadeCall(gomock.Any(), "CharmConfig", args, result).SetArg(3, results).Return(nil)
755751

756752
client := application.NewClientFromCaller(mockFacadeCaller)
757-
res, err := client.GetConfig(newBranchName, "foo", "bar")
753+
res, err := client.GetConfig("foo", "bar")
758754
c.Assert(err, jc.ErrorIsNil)
759755
c.Assert(res, jc.DeepEquals, []map[string]interface{}{
760756
fooConfig, barConfig,
@@ -827,7 +823,6 @@ func (s *applicationSuite) TestSetConfig(c *gc.C) {
827823
ApplicationName: "foo",
828824
Config: fooConfig,
829825
ConfigYAML: fooConfigYaml,
830-
Generation: newBranchName,
831826
}}}
832827
result := new(params.ErrorResults)
833828
results := params.ErrorResults{
@@ -839,7 +834,7 @@ func (s *applicationSuite) TestSetConfig(c *gc.C) {
839834
mockFacadeCaller.EXPECT().FacadeCall(gomock.Any(), "SetConfigs", args, result).SetArg(3, results).Return(nil)
840835

841836
client := application.NewClientFromCaller(mockFacadeCaller)
842-
err := client.SetConfig(newBranchName, "foo", fooConfigYaml, fooConfig)
837+
err := client.SetConfig("foo", fooConfigYaml, fooConfig)
843838
c.Assert(err, gc.ErrorMatches, "FAIL")
844839
}
845840

@@ -851,7 +846,6 @@ func (s *applicationSuite) TestUnsetApplicationConfig(c *gc.C) {
851846
Args: []params.ApplicationUnset{{
852847
ApplicationName: "foo",
853848
Options: []string{"option"},
854-
BranchName: newBranchName,
855849
}},
856850
}
857851
result := new(params.ErrorResults)
@@ -864,7 +858,7 @@ func (s *applicationSuite) TestUnsetApplicationConfig(c *gc.C) {
864858
mockFacadeCaller.EXPECT().FacadeCall(gomock.Any(), "UnsetApplicationsConfig", args, result).SetArg(3, results).Return(nil)
865859

866860
client := application.NewClientFromCaller(mockFacadeCaller)
867-
err := client.UnsetApplicationConfig(newBranchName, "foo", []string{"option"})
861+
err := client.UnsetApplicationConfig("foo", []string{"option"})
868862
c.Assert(err, gc.ErrorMatches, "FAIL")
869863
}
870864

api/client/modelgeneration/export_test.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)