/srv/irclogs.ubuntu.com/2007/06/03/#upstart.txt

=== wasabi_ [n=wasabi@cpe-76-184-122-13.tx.res.rr.com] has joined #upstart
=== jonibo [n=jonas@ua-83-227-144-18.cust.bredbandsbolaget.se] has joined #upstart
=== AlexExtreme wonders if NihHash would be a better storage type for the list of profile entries
=== Md [i=md@freenode/staff/md] has joined #upstart
=== AlexExtreme [n=AlexExtr@frugalware/developer/AlexExtreme] has joined #upstart
=== rgl [n=Rui@84.90.10.107] has joined #upstart
rglhi01:12
rglAlexExtreme, why is this """When a job is disabled by the current profile, it still responds to events, it'll just not actually start. If the system is currently in a state when it can be running, and the profile is changed to one which allows it to be run, it'll start.""" ?01:13
rglwhy to refuse to start a job?01:13
AlexExtremebecause that's what disabling a job is?01:13
rglI mean, if the admin wants to start a job that is not in the current profile, why should he be refrained from starting it anyways?01:13
=== Keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
rglfor me "disabling" is "disabling the service from being automatically started"01:14
AlexExtremergl, it would only be disallowed from starting if the profile specifically states that that job is disabled, and even then it could still be started manually01:14
rglyes, I understood that.  what I don't understant is why :D01:15
rgl"why you want to do that"01:15
AlexExtreme<rgl> for me "disabling" is "disabling the service from being automatically started"01:15
AlexExtremethat's exactly what it does...01:15
Keybuksounds like you're both arguing for the same thing :)01:15
AlexExtremeyou can still start it manually01:15
rglah :-)01:16
rglsorry for the confusion :D01:16
Keybukthat makes the most sense to me as well01:18
Keybuk"disabled" jobs don't react to events, but still show up in lists, and can still be manually started/stopped01:18
AlexExtremeyeah01:20
AlexExtremehmm01:29
AlexExtremein terms of profiles, i'll be doing lookups by name quite often, both when parsing a profile and starting a job. so a hash would be more efficient01:31
AlexExtremeand i hadn't thought of using wildcards for job name matching. hrm01:31
rglah, so my email has something useful? :-)01:41
AlexExtremeyep :p01:42
Keybukthe interesting thing about Profiles, compared to the original Flags idea, is that Profiles are defined separately to Jobs01:55
Keybukfor Flags, the idea was that a Job listed the states it was enabled/disabled in01:55
Keybukthe thing I like about Profiles is that it's up to the sysadmin how Jobs are grouped01:55
AlexExtremeyes01:55
AlexExtremeIMO it's much more flexible01:55
Keybukso this has got me thinking a bit01:56
KeybukProfiles are fundamentally groups of Jobs01:56
Keybuk"these are the jobs that do things with networking"01:56
Keybuk"these are the jobs that do multi-user things"01:56
Keybuk"these are the jobs when the machine is acting as a web-server"01:56
Keybuk(I often used runlevel 3 in sysvinit for the latter, so I could turn on/off apache/postgresql/etc. which were expensive to run)01:57
Keybukdoes that sound kinda right?01:58
AlexExtremeyeah01:58
Keybukan interesting side-effect of the "disable means no auto-start" functionality is that if you disabled udev, then you inherently disable all jobs that react to udev events01:59
Keybukso that's quite nice01:59
rglcan we please have multiple profiles active? :D02:01
rglthough, that goes against the word "profile", so maybe we should have job groups *G*02:01
rgl("job groups" the name)02:02
AlexExtremeside note: i noticed the kbdrequest event earlier - what exactly is it useful for?02:02
KeybukAlexExtreme: I think it's supposed to be "spawn a new getty" *shrug*02:06
Keybukrgl: yeah, that's what I've been thinking02:06
Keybuksince a Profile basically acts as a group of Jobs02:06
Keybukmaybe we don't need to specify enable/disable in a profile02:06
Keybukinstead it just needs to include jobs by name02:07
Keybukand then you can enable/disable a profile02:07
AlexExtremethis profiles idea gets more complicated by the day *g*02:07
rgland have a directory with all the jobs in the profile (instead of a file;  like I've said some of this day hehe) *G*02:08
AlexExtremeno02:08
AlexExtremei will never, ever have that. it'd be a complete mess. we might as well just go back to /etc/rc*.d...02:08
Keybukrgl: why would a directory be good?  then a job couldn't be in multiple profiles02:08
AlexExtremethat'd be possible, of course, with nice symlinks all over the place02:09
KeybukAlexExtreme: well, if a profile is just a list of jobs, and enabled/disabled, you just need to check whether any of the profiles the job is listed in are disabled02:09
Keybukeww, symlinsk02:09
Keybuksymlinks are evil as a configuration mechanism02:09
rglyou chould just touch the file.02:10
rgl(no symlink)02:10
Keybukempty files?02:10
Keybukthat's just as bad <g>02:10
AlexExtremethere'd be still little files everywhere02:10
Keybukvery djb-ish02:10
AlexExtremeyeah02:11
AlexExtremethat's what i hated with djb/runit :P02:11
rgldjb-ish is good for ya!02:11
rglI love it :D02:11
AlexExtremeservice == directory and scripts/files inside02:11
AlexExtremewhy not just one file?02:11
Keybukmy Profiles musing went a bit further ,.. <g>02:12
Keybukif a profile is a list of jobs, and if a profile can be disabled or enabled02:12
rglits easier to admin using regular CLI tool?  touch/rm vs using a command to parse the file and do that.02:12
Keybukthen you could link profiles to a state <g>02:12
AlexExtremergl, how is it easier? it'd be a complete nightmare for the distro developers02:13
rglAlexExtreme, nightmare?  why?02:13
Keybuktouch vs vi is pretty even02:13
Keybukthe modify command approach is better, since it can guarantee integrity02:14
Keybuk(what is the behaviour if you touch the name of a job that doesn't exist?)02:14
rglKeybuk, its the same has using vi and inserting it in the profile file ;)02:14
Keybukrgl: exactly, there's no admin difference02:15
rglKeybuk, there is.  to enable a service you have to use upstart-profile-enable-service service vs touch something02:16
Keybuk?02:16
Keybukno, you can use vi02:16
AlexExtremeor easier:02:17
AlexExtremeecho "enable myjob" >> /etc/init/profiles.d/myprofile02:17
rglKeybuk, why did debian decide to use enabled-sites/ directories instead of using "Include" in the file?02:17
rglAlexExtreme, and to remove? :D02:17
AlexExtremesed -i '/enable myjob/d' /etc/init/profiles.d/myprofile02:18
rglAlexExtreme, my point is, you have to use a command for doing it.  but its a mater of taste *shrug*02:18
rglAlexExtreme, obsioly, thats not that simple.02:18
AlexExtremeyou have to use a command if you've got directories too02:19
rglAlexExtreme, you have to skip comments, etc.02:19
rgllets not paint the bikeshed anymore ;-)02:20
Keybukrgl: how do you comment out the disabling of a service with your method?02:20
rglKeybuk, humm, I was not thinking of disabling jobs.  this was a "enable only" thing.  if you want to disable the job, just rm the job from the profile.02:22
AlexExtremetake this as an example:02:22
AlexExtremeif a distro developer provided a job with a package and wanted that job enabled in all profiles by default02:22
AlexExtremethey'd have to go through each profile and add it in02:22
Keybukrgl: no, I just want to comment it out for a while02:23
Keybukyou can't do that with the file technique02:23
Keybukand you can't document why it's removed02:23
Keybuk# keybuk - think this is breaking networking - 02jun0702:23
AlexExtremesurely it would be easier to just put it in /etc/event.d or whatever and have the profile "enable/disable *" lines handle it02:23
Keybuk# ntpdate02:23
rglAlexExtreme, document?  use a automated thing to administer your box? :D02:24
rglerr02:24
rglthat was for Keybuk :D02:24
AlexExtremehuh?02:25
AlexExtremewhat has an "automated thing" got to do with anything?02:25
rglAlexExtreme, with the "document" part that Keybuk said.   02:25
AlexExtremei still don't get what it's got to do with that02:26
AlexExtremebrb, lunch02:26
Keybukanyway, it's my bikeshed, and we're using configuration files; not directories-o-symlinks or djb madness <g>02:27
rglI was just saying that the "document" part could be addressed by your automated tool.  (if you don't use one, yeah, it sux, and you can't document)02:27
Keybukyou can't document in the model you suggest though02:28
rglKeybuk, fair enough :-)02:28
Keybukyou'd need another directory of documents about why things aren't in another one02:28
AlexExtremebtw Keybuk, it'd make sense to put all the profile stuff into a seperate source file (like profile.{c,h}) rather than sticking it onto the parsing stuff in cfgfile.c, right? if i were to put it in cfgfile.c it'd allow you to put job stanzas in profiles and vice-versa, which isn't what i want, really ;)02:55
Keybukit should have a separate stanzas list, yes03:26
AlexExtremek03:26
Keybukthat file is a little mixed up03:28
Keybuksince it has the parsing and watching code too03:28
Keybuk(which should be shared)03:28
=== juergbi [n=juerg@80-219-16-162.dclient.hispeed.ch] has joined #upstart
=== __keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
AlexExtremehmm, profile.c written. now to plug it in to the rest of upstart ;)03:43
=== Keybuk keeps hitting namespace problems
AlexExtremewith what?03:49
Keybukright now we're relying on the filesystem to provide the namespace03:50
Keybukif we allow people to define multiple jobs in one file, how do we enforce that?03:50
Keybuk(likewise for profiles)03:50
AlexExtremehmm03:51
Keybukobviously we have to solve this if we want people to be able to register jobs over the initctl socket03:55
AlexExtremei'm not quite sure i understand03:55
Keybukwell03:55
Keybuklet's say I make /etc/init/jobs.d/foo03:55
Keybukand I also make /etc/init/upstart.conf and put03:56
Keybuk  job foo03:56
Keybuk    ...03:56
Keybuk  end foo03:56
Keybukin it03:56
Keybukwhich gets priority?03:56
Keybuk(and how do we stop them both fighting)03:56
AlexExtremehrm03:56
AlexExtremei would say the one in upstart.conf gets priority03:57
AlexExtremetake this as an example:03:57
Keybukso the first one parsed?03:57
AlexExtremea distribution provides a job called foo, and the user wants to override that job with their own version without editing the one provided by their distro03:57
Keybuk(assuming upstart.conf is registered first)03:57
AlexExtremethey could put their version in upstart.conf03:58
AlexExtremeand it would get priority03:58
Keybukok, and self-registered would take priority over that?03:58
AlexExtremethey could easily revert to the distros version by simply commenting out their version03:58
AlexExtremeyes03:58
Keybukthat makes it easy then03:58
Keybuka Job just needs to know which CfgSource it was registered with03:58
Keybukand when loading a job from a source, check the source is the same03:58
Keybukthough this means you can't move a job from one source to another03:59
Keybukif you delete /etc/init.d/upstart.conf, the jobs.d/foo one wouldn't show up unless touched03:59
AlexExtremeit's not that big a problem, and if it could be solved by touching the other one, then it's a minor problem04:00
KeybukI'd prefer it to be solved internally04:00
Keybukwe'd need a JobName structure that tracked, for a given name, what was available from each source, and whether each of those things had replacements04:01
Keybukthat's a bit sucky, since we'd need the same for Profile and State04:06
=== rgl_ [n=Rui@84.90.10.107] has joined #upstart
AlexExtremehmm05:42
AlexExtremesay a job has been disabled in a profile, yet the sysadmin has started it manually. should the job respond to stop events?05:43
rgl_I think it should.05:54
AlexExtrememe too05:54
Keybukyes05:56
Keybukprofiles should just affect start events05:56
Keybukcf. job is running, and sysadmin disables the profile, it should still stop later05:56
Keybukmaybe it should stop immediately too05:57
=== Keybuk tries to come up with a sensible filename for "job definition parsing"
Keybukin theory, we should be able to use the same pattern for "state definition" and "profile definition"06:01
AlexExtremeyou mean source file name?06:08
Keybukyeah06:09
AlexExtremeparser.c ? :P06:10
Keybukdoesn't say "job" though06:11
Keybukso we'd have to put state and profile parsing in the same file06:11
AlexExtremejobparse.c06:12
Keybukand stateparse.c and profileparse.c ?06:13
AlexExtremehmm.06:13
AlexExtremea bit long :p06:13
Keybukheh06:14
KeybukI didn't realise there was a length limit <g>06:14
AlexExtrememeh ;)06:15
=== AlexExtreme usually tries to keep it short and sweet
AlexExtremewell, that's a start06:17
AlexExtremethe profile code compiled ;)06:17
AlexExtremei'll test it in a minute :P06:17
Keybuk<g>06:18
Keybukyou're supposed to write the tests *first* :p06:18
Keybuk(not that I ever do)06:25
AlexExtreme:P06:31
wasabiHeh. I've never found TDD works on a budget.06:32
KeybukI find that about 75% of my coding time is spent refactoring test cases06:33
Keybukwhich is about the same amount of time I spent figuring out how I broke things06:33
AlexExtremeheh06:33
AlexExtremeok, brb. if i don't come back, you'll know it hasn't worked :p06:33
Keybukthe net gain of course, is that the 75% now happens *before* I ship the tarball06:33
KeybukAlexExtreme: just comment out the bits of main.c that assume pid()==1 :p06:34
AlexExtremeyeeep, i broke it :P06:37
Keybuklol06:41
AlexExtremesomehow i'm getting an assertion failure on line 521 in string.c06:41
AlexExtremehow, i don't know, because i'm never calling the function that's it06:42
AlexExtreme*in06:43
Keybuklol06:44
Keybukwhat's the backtrace?06:44
AlexExtremewhere does that come from? :p06:45
AlexExtremecore dump?06:45
Keybukyeah06:47
AlexExtremehmm06:47
AlexExtremeit would help if the FS was read write06:47
AlexExtremehang on :p06:47
Keybuktest_cfgfile.c is annoying long06:52
AlexExtremehmm06:59
AlexExtremewell the core dump was officially useless06:59
AlexExtremeinit was compiled without debug symbols :P07:00
AlexExtremeahhhh07:02
AlexExtremei see what i did wrong :p07:02
Keybuk--disable-compiler-optimisations --disable-linker-optimisations --enable-warnings07:03
Keybuk:P07:03
AlexExtremeprofile_get_job_status (job) << usually it helps to pass job->name to that function07:03
AlexExtremelet's try again ;)07:07
wasabiKeybuk: Yeah, which is great, when you're not on a budget. ;)07:19
wasabiOtherwise shipping the 75% is acceptable. Heh.07:19
AlexExtremeso it appears i'm managing to do something weird to job->cause07:26
AlexExtremebrb, dinner07:26
=== mbiebl [n=michael@e180067250.adsl.alicedsl.de] has joined #upstart
=== cort [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
Keybukwoo, test passes07:57
Keybuknow to fix valgrind07:58
Keybukeasy; just a couple of "returning without freeing if -ENOMEM" bugs08:00
AlexExtremeit's interesting to note that i still get this assert failed if i revert all my changes08:01
rgl_how you guys test upstart?  using UML?08:03
Keybukodd08:03
Keybukrgl_: "make check"08:03
rgl_how do I run upstart without being proc #1?08:03
AlexExtremelet's try the completely vanilla tree08:03
Keybukrgl_: you can't at the moment, without patching the code08:04
rgl_Keybuk, so make check tests a running upstart?08:05
AlexExtremeno, it tests the code08:05
Keybukrgl_: no, it's a suite of stuff that tests the code08:05
Keybukunit tests, basically08:05
rgl_ah, no integration tests yet. ok.08:06
AlexExtremeok, i'm getting this bug with a vanilla tree08:07
AlexExtremeKeybuk, want a backtrace?08:07
Keybuksure08:08
Keybukrgl_: define integration tests, in this case08:08
AlexExtremeKeybuk, http://frugalware.org/paste/148008:09
KeybukI've never been clear exactly where unit and integration testing are supposed to be different08:09
Keybuksince pure unit testing supposes you can test just one function08:10
Keybuk(which you never can)08:10
KeybukAlexExtreme: which upstart version?08:11
AlexExtremeit's latest bzr08:11
AlexExtreme0.3.8 works fine08:11
Keybukah, interesting08:11
Keybuk        * init/event.c (event_new): Start off with NULL args and env, to08:12
Keybuk        match job (saves a few bytes).08:12
Keybuk        (event_match): Watch for NULL arguments!08:12
Keybuk        * init/tests/test_event.c (test_new): Check for NULL not alloc'd08:12
Keybukheh08:12
rgl_Keybuk, test the whole shebang as a blackbox.  like, have some jobs, kill a job, see if its restarted, and stff like that.  also, test the "problem" I've mention a days before: edit job, start a service that is a symlink, and see it does not work.08:13
KeybukAlexExtreme: if statement on job.c 1372 needs "&& job->cause->info.args" added08:14
Keybukrgl_: that's System Testing08:15
rgl_Keybuk, isn't that the same as integration tests?08:16
rgl_(though, its the first time I've heard of system testing hehe)08:16
Keybukwell08:17
Keybukusually you're supposed to have08:17
KeybukUnit Testing -> Integration Testing -> System Testing08:17
Keybukunit supposes you can test each individual function08:17
Keybukintegration is where you join functions together, and run scenarios through it08:17
AlexExtremeok, let's test that08:18
AlexExtremebrb08:18
Keybuksystem is when you have the finished system, and apply checks to make sure it works08:18
Keybukthe Upstart test suite is something of a combination of Unit (where possible) and Integration08:18
Keybukfrequently tests are running much of the Upstart code08:19
Keybuke.g. we have tests to set up a socket, and all of the code to listen to it, then we poke commands into it and see how the states of jobs change, and what events are emitted, etc.08:19
rgl_ah alright :D08:19
KeybukSystem Testing is when I install and reboot08:19
Keybukand if it fails, then I don't get to my desktop, so I can't upload the tarball <g>08:20
rgl_hehe08:20
rgl_though, using UML could facilitate that (but for sure you known it hehe)08:20
KeybukI don't know UML08:21
Keybukor do you mean User-Mode-Linux?08:21
AlexExtremeI use VMware for that kinda thing :p08:21
rgl_oh yes, sorry.  yes.  user-mode-linux08:21
AlexExtrememental note: it helps to apply the fix before testing it08:21
Keybukyeah, I use vmware for some stuff08:21
Keybukthough mostly I just install it and see what happens08:21
AlexExtremeKeybuk, what line was it on (the if block to change)?08:22
Keybuk137208:22
Keybukis it bad to push incomplete code to main? :p08:23
AlexExtremeas long as i don't bzr pull :p08:23
Keybuklol08:23
Keybukyou wouldn't be able to, you're diverged now, no?08:23
AlexExtremetrue08:24
AlexExtremeif it works this time i'll commit it to a new branch08:24
AlexExtremebrb08:25
AlexExtremeOMG08:27
AlexExtremeIt worked :P08:27
AlexExtremebbl08:32
=== cort [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== Keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
=== __keybuk [n=scott@wing-commander.netsplit.com] has joined #upstart
=== cort [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
=== cort [n=sam@62-31-146-25.cable.ubr12.azte.blueyonder.co.uk] has joined #upstart
AlexExtremehttps://code.launchpad.net/~alex-extreme2/upstart/profiles09:23
AlexExtremenight10:02
=== mbiebl [n=michael@e180067250.adsl.alicedsl.de] has joined #upstart

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!