Closed Bug 1019013 Opened 10 years ago Closed 10 years ago

tweaks::cleanup should work with puppet disabled, at least on linux

Categories

(Infrastructure & Operations :: RelOps: Puppet, task)

x86_64
Linux
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rail, Assigned: mrrrgn)

References

Details

(Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1130] )

Attachments

(1 file, 3 obsolete files)

... because we are going to use puppetles spot instances ATM we use it only for Ubuntu and Mac (not for builders). /tmp is cleanup up at boot time by default. We should make sure to delete $::users::builder::home/.mozilla/firefox/console.log on boot.
These should go into the pre-run scripts, right?
(In reply to Dustin J. Mitchell [:dustin] from comment #2) > These should go into the pre-run scripts, right? Actually, yes. There would be no need to install extra packages, such as tmpreaper, tmpwatch, etc.
Depends on: 712206
Ian, just to put this on your radar :)
Attached patch tmpclean-puppet.diff (obsolete) (deleted) — Splinter Review
CentOS only for now.
Attachment #8484243 - Flags: review?(catlee)
Comment on attachment 8484243 [details] [diff] [review] tmpclean-puppet.diff Review of attachment 8484243 [details] [diff] [review]: ----------------------------------------------------------------- ::: modules/runner/templates/tasks/cleanup.erb @@ +8,5 @@ > + > +if [ "$USER" != "<%= scope.lookupvar('::config::builder_username') %>" ]; then > + sudo -E -u <%= scope.lookupvar('::config::builder_username') %> $0 $* > + exit $? > +fi so, do we actually want to sudo here? it's more likely we can delete files in /home and /tmp as root, right?
(In reply to Chris AtLee [:catlee] from comment #6) > Comment on attachment 8484243 [details] [diff] [review] > tmpclean-puppet.diff > > Review of attachment 8484243 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: modules/runner/templates/tasks/cleanup.erb > @@ +8,5 @@ > > + > > +if [ "$USER" != "<%= scope.lookupvar('::config::builder_username') %>" ]; then > > + sudo -E -u <%= scope.lookupvar('::config::builder_username') %> $0 $* > > + exit $? > > +fi > > so, do we actually want to sudo here? it's more likely we can delete files > in /home and /tmp as root, right? Per http://www.explainshell.com/explain?cmd=sudo+-E+-u++cltbld+%240+%24* -u user The -u (user) option causes sudo to run the specified command as a user other than root. To specify a uid instead of a user name, use #uid. When running commands as a uid, many shells require that the '#' be escaped with a backslash ('\'). Security policies may restrict uids to those listed in the password database. The sudoers policy allows uids that are not in the password database as long as the targetpw option is not set. Other security policies may not support this.
(In reply to Justin Wood (:Callek) from comment #7) > (In reply to Chris AtLee [:catlee] from comment #6) > > so, do we actually want to sudo here? it's more likely we can delete files > > in /home and /tmp as root, right? > (err re-read your Q, and forgive me jumping in, /me goes to relearn how to read)
(In reply to Chris AtLee [:catlee] from comment #6) > so, do we actually want to sudo here? it's more likely we can delete files > in /home and /tmp as root, right? I think you are right, no sudo here. It would fail cleaning up /tmp
Attached patch tmpclean-puppet-1.diff (obsolete) (deleted) — Splinter Review
Attachment #8484243 - Attachment is obsolete: true
Attachment #8484243 - Flags: review?(catlee)
Attachment #8484366 - Flags: review?(catlee)
Comment on attachment 8484366 [details] [diff] [review] tmpclean-puppet-1.diff We may need to avoid cleaning up /tmp if we run runner multiple times without reboots.
Attachment #8484366 - Flags: review?(catlee)
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/388]
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/388] → [kanban:engops:https://kanbanize.com/ctrl_board/6/392]
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/392]
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/486]
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/486] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1119] [kanban:engops:https://kanbanize.com/ctrl_board/6/486]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1119] [kanban:engops:https://kanbanize.com/ctrl_board/6/486] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1128] [kanban:engops:https://kanbanize.com/ctrl_board/6/486]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1128] [kanban:engops:https://kanbanize.com/ctrl_board/6/486] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1129] [kanban:engops:https://kanbanize.com/ctrl_board/6/486]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1129] [kanban:engops:https://kanbanize.com/ctrl_board/6/486] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1130] [kanban:engops:https://kanbanize.com/ctrl_board/6/486]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1130] [kanban:engops:https://kanbanize.com/ctrl_board/6/486] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1130]
Assignee: rail → winter2718
Attached patch cleanup-osx-and-linux.diff (obsolete) (deleted) — Splinter Review
This changes the cleanup bash script just a bit, and applies the change to all the places where tweaks::cleanup was before. This is now possible since runner works on OSX.
Attachment #8484366 - Attachment is obsolete: true
Attachment #8526563 - Flags: review?(rail)
Comment on attachment 8526563 [details] [diff] [review] cleanup-osx-and-linux.diff Review of attachment 8526563 [details] [diff] [review]: ----------------------------------------------------------------- ::: modules/runner/templates/tasks/cleanup.erb @@ +8,5 @@ > + > +BUILDER_HOME="<%= scope.lookupvar('::users::builder::home') %>" > + > +if [ $(uname) = "Darwin" ]; then > + rm -fv "${BUILDER_HOME}/.mozilla/firefox/console.log" I think the logic should be inverted here, Darwin should remove "${BUILDER_HOME}/Library/Application Support/Firefox/console.log"
Comment on attachment 8526563 [details] [diff] [review] cleanup-osx-and-linux.diff Review of attachment 8526563 [details] [diff] [review]: ----------------------------------------------------------------- Derp, yes!
Attached patch cleanup-osx-and-linux.diff (deleted) — Splinter Review
Attachment #8526563 - Attachment is obsolete: true
Attachment #8526563 - Flags: review?(rail)
Attachment #8526750 - Flags: review?(rail)
Testing this out over the weekend, will merge if all goes well. :)
Comment on attachment 8526750 [details] [diff] [review] cleanup-osx-and-linux.diff Review of attachment 8526750 [details] [diff] [review]: ----------------------------------------------------------------- LGTM!
Attachment #8526750 - Flags: review?(rail) → review+
Attachment #8526750 - Flags: checked-in+
Okay, this seems to be working out. Shipping it!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: