Skip to content

Commit

Permalink
Removes unused systemd default search path directory argument from
Browse files Browse the repository at this point in the history
WriteSystemdAgents.
  • Loading branch information
manadart committed Jan 24, 2020
1 parent e04f31b commit 4db2f6f
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 21 deletions.
8 changes: 4 additions & 4 deletions service/agentconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type SystemdServiceManager interface {
// WriteSystemdAgents creates systemd files and create symlinks for the
// list of machine and units passed in the standard filepath.
WriteSystemdAgents(
machineAgent string, unitAgents []string, dataDir, symLinkSystemdDir, symLinkSystemdMultiUserDir string,
machineAgent string, unitAgents []string, dataDir, symLinkSystemdMultiUserDir string,
) ([]string, []string, []string, error)

//CreateAgentConf creates the configfile for specified agent running on a
Expand All @@ -53,7 +53,8 @@ type SystemdServiceManager interface {

// CopyAgentBinary copies all the tools into the path specified for each agent.
CopyAgentBinary(
machineAgent string, unitAgents []string, dataDir, toSeries, fromSeries string, jujuVersion version.Number) error
machineAgent string, unitAgents []string, dataDir, toSeries, fromSeries string, jujuVersion version.Number,
) error

// StartAllAgents starts all the agents in the machine with specified series.
StartAllAgents(machineAgent string, unitAgents []string, dataDir string) (string, []string, error)
Expand Down Expand Up @@ -103,7 +104,6 @@ func (s *systemdServiceManager) WriteServiceFiles() error {
machineAgent,
unitAgents,
paths.NixDataDir,
systemd.EtcSystemdDir,
systemd.EtcSystemdMultiUserDir,
)
if err != nil {
Expand Down Expand Up @@ -164,7 +164,7 @@ func (s *systemdServiceManager) FindAgents(dataDir string) (string, []string, []
// WriteSystemdAgents creates systemd files and symlinks for the input machine
// and unit agents, in the standard filepath '/var/lib/juju'.
func (s *systemdServiceManager) WriteSystemdAgents(
machineAgent string, unitAgents []string, dataDir, symLinkSystemdDir, symLinkSystemdMultiUserDir string,
machineAgent string, unitAgents []string, dataDir, symLinkSystemdMultiUserDir string,
) ([]string, []string, []string, error) {
var (
startedSysServiceNames []string
Expand Down
10 changes: 5 additions & 5 deletions service/agentconf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *agentConfSuite) listServices() ([]string, error) {
return s.serviceData.InstalledNames(), nil
}

func (s *agentConfSuite) newService(name string, conf common.Conf) (service.Service, error) {
func (s *agentConfSuite) newService(name string, _ common.Conf) (service.Service, error) {
for _, svc := range s.services {
if svc.Name() == name {
return svc, nil
Expand Down Expand Up @@ -290,7 +290,7 @@ func (s *agentConfSuite) TestCopyAgentBinaryOriginalAgentBinariesNotFound(c *gc.

func (s *agentConfSuite) TestWriteSystemdAgents(c *gc.C) {
startedSymLinkAgents, startedSysServiceNames, errAgents, err := s.manager.WriteSystemdAgents(
s.machineName, s.unitNames, s.systemdDataDir, s.systemdDir, s.systemdMultiUserDir)
s.machineName, s.unitNames, s.systemdDataDir, s.systemdMultiUserDir)

c.Assert(err, jc.ErrorIsNil)
c.Assert(startedSysServiceNames, gc.HasLen, 0)
Expand All @@ -306,7 +306,7 @@ func (s *agentConfSuite) TestWriteSystemdAgentsSystemdNotRunning(c *gc.C) {
)

startedSymLinkAgents, startedSysServiceNames, errAgents, err := s.manager.WriteSystemdAgents(
s.machineName, s.unitNames, s.systemdDataDir, s.systemdDir, s.systemdMultiUserDir)
s.machineName, s.unitNames, s.systemdDataDir, s.systemdMultiUserDir)

c.Assert(err, jc.ErrorIsNil)
c.Assert(startedSymLinkAgents, gc.HasLen, 0)
Expand All @@ -323,7 +323,7 @@ func (s *agentConfSuite) TestWriteSystemdAgentsDBusErrManualLink(c *gc.C) {
)

startedSymLinkAgents, startedSysServiceNames, errAgents, err := s.manager.WriteSystemdAgents(
s.machineName, s.unitNames, s.systemdDataDir, s.systemdDir, s.systemdMultiUserDir)
s.machineName, s.unitNames, s.systemdDataDir, s.systemdMultiUserDir)

c.Assert(err, jc.ErrorIsNil)

Expand All @@ -342,7 +342,7 @@ func (s *agentConfSuite) TestWriteSystemdAgentsWriteServiceFail(c *gc.C) {
)

startedSymLinkAgents, startedSysServiceNames, errAgents, err := s.manager.WriteSystemdAgents(
s.machineName, s.unitNames, s.systemdDataDir, s.systemdDir, s.systemdMultiUserDir)
s.machineName, s.unitNames, s.systemdDataDir, s.systemdMultiUserDir)

c.Assert(err, gc.ErrorMatches, "fail me")
c.Assert(startedSysServiceNames, gc.HasLen, 0)
Expand Down
40 changes: 40 additions & 0 deletions worker/upgradeseries/mocks/package_mock.go

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

Loading

0 comments on commit 4db2f6f

Please sign in to comment.