Skip to content

Commit

Permalink
Use jujud user for machine agent
Browse files Browse the repository at this point in the history
Since juju now only creates one service, the machine agent, we need
to run that as a normal user.
  • Loading branch information
gabriel-samfira committed Apr 19, 2021
1 parent 0130415 commit abee5b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cloudconfig/windows_userdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ mongoversion: "0.0"
"@
cmd.exe /C mklink /D C:\Juju\lib\juju\tools\machine-10 1.2.3-windows-amd64
New-Service -Name 'jujud-machine-10' -DependsOn Winmgmt -DisplayName 'juju agent for machine-10' '"C:\Juju\lib\juju\tools\machine-10\jujud.exe" machine --data-dir "C:\Juju\lib\juju" --machine-id 10 --debug'
New-Service -Credential $jujuCreds -Name 'jujud-machine-10' -DependsOn Winmgmt -DisplayName 'juju agent for machine-10' '"C:\Juju\lib\juju\tools\machine-10\jujud.exe" machine --data-dir "C:\Juju\lib\juju" --machine-id 10 --debug'
sc.exe failure 'jujud-machine-10' reset=5 actions=restart/1000
sc.exe failureflag 'juju agent for machine-10' 1%!(EXTRA string='"C:\Juju\lib\juju\tools\machine-10\jujud.exe" machine --data-dir "C:\Juju\lib\juju" --machine-id 10 --debug', string='jujud-machine-10', string='jujud-machine-10')
sc.exe failureflag 'jujud-machine-10' 1
Start-Service 'jujud-machine-10'`
2 changes: 1 addition & 1 deletion service/windows/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,6 @@ func (s *Service) StartCommands() ([]string, error) {
}

const serviceCreateCommandTemplate = `
New-Service -Name %s -DependsOn Winmgmt -DisplayName %s %s
New-Service -Credential $jujuCreds -Name %s -DependsOn Winmgmt -DisplayName %s %s
sc.exe failure %s reset=5 actions=restart/1000
sc.exe failureflag %s 1`
2 changes: 1 addition & 1 deletion service/windows/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (s *serviceSuite) TestInstallCommands(c *gc.C) {
c.Assert(err, gc.IsNil)

expected := []string{
fmt.Sprintf("New-Service -Name '%s' -DependsOn Winmgmt -DisplayName '%s' '%s'", s.name, s.conf.Desc, s.conf.ExecStart),
fmt.Sprintf("New-Service -Credential $jujuCreds -Name '%s' -DependsOn Winmgmt -DisplayName '%s' '%s'", s.name, s.conf.Desc, s.conf.ExecStart),
fmt.Sprintf("sc.exe failure '%s' reset=5 actions=restart/1000", s.name),
fmt.Sprintf("sc.exe failureflag '%s' 1", s.name),
}
Expand Down

0 comments on commit abee5b2

Please sign in to comment.