-
Notifications
You must be signed in to change notification settings - Fork 107
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
Fix LaunchAgents directory permissions, bail if -install
is run with sudo
#244
Conversation
return nil | ||
} | ||
|
||
func Stop() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to dev/stop.go
, since it's used in both linux and darwin (and doesn't have anything to do with setup)
LaunchAgentDirPath string | ||
Domains string | ||
Timeout string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide args type to approximate named function params.
@@ -44,6 +44,7 @@ func TestServeDNS(t *testing.T) { | |||
|
|||
return nil | |||
}, | |||
retry.Attempts(3), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit retries to 3 in tests to help fail faster. added while debugging another issue.
Domains: *fDomains, | ||
LaunchAgentDirPath: "~/Library/LaunchAgents", | ||
ListenPort: *fInstallPort, | ||
LogfilePath: "~/Library/Logs/puma-dev.log", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a good idea to pull this out into shared variable, then add something like puma-dev -f logs
(similar to heroku -f logs
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, coming in follow-up PR.
-install
is run with sudo
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: go-${{ matrix.go-version }}-${{ matrix.os }} | ||
path: coverage.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that this uploads to a zip, kinda useless.
timeout: 1m | ||
tests: true | ||
service: | ||
golangci-lint-version: 1.24.x # use the fixed version to not introduce new linters unexpectedly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropping this here to potentially include in CI in future.
./puma-dev -d 'test:localhost:loc.al:puma' -install | ||
test -f "$$HOME/Library/LaunchAgents/io.puma.dev.plist" | ||
sleep 2 | ||
test -f "$$HOME/Library/Logs/puma-dev.log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we can't test the "default" install path inside unit tests, provide this helper to guarantee that files exist as expected.
i have a follow-up PR that reworks this a bit.
Domains: *fDomains, | ||
LaunchAgentDirPath: "~/Library/LaunchAgents", | ||
ListenPort: *fInstallPort, | ||
LogfilePath: "~/Library/Logs/puma-dev.log", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, coming in follow-up PR.
@@ -95,7 +95,21 @@ func Cleanup() { | |||
} | |||
} | |||
|
|||
func InstallIntoSystem(listenPort, tlsPort int, dir, domains, timeout string) error { | |||
type InstallIntoSystemArgs struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if convention is to call this -Args
or -Params
or something else...
plist := homedir.MustExpand("~/Library/LaunchAgents/io.puma.dev.plist") | ||
|
||
err = os.MkdirAll(plistDir, 0644) | ||
err = os.MkdirAll(plistDir, 0755) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the bugfix.
Resolves #141
Resolves #76
~/Library/LaunchAgents
(if it doesn't exist) are incorrectly set to 0644 instead of 0755. This PR correctly sets it to 0755.puma-dev install
under sudo, we bail out immediately.Changes
0644
to0755
@ (will_provide_link)InstallIntoSystem
to take a struct for all its arguments.setup_test.go
to verify thatInstallIntoSystem
creates the directory with the correct permissions.Write a test that ONLY runs on TravisCI machines that actually exercises thePunting on this. It's hairy.-setup
main path. Not sure how that will go...-install
to run withsudo
.