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

2.7 Systemd Service Writer Refactoring #11149

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Removes unused systemd default search path directory argument from
WriteSystemdAgents.
  • Loading branch information
manadart committed Jan 24, 2020
commit 4db2f6f2999e3a6efa4746ca1f0e115080c7871a
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