/srv/irclogs.ubuntu.com/2008/12/19/#upstart.txt

sadmacKeybuk: and it "belongs" in /usr/apache/conf if upstream has their sya00:00
sadmac*say00:00
Keybukoh, that's right, you guys rename it for some inexplicable reason00:00
sadmacKeybuk: so do you.00:00
Keybukwe call it apache200:01
sadmacyep. Its not supposed to be.00:01
sadmacits supposed to just be apache, and (scarier) its not supposed to be in etc00:01
Keybukok, true, it should be apache00:01
Keybukbut apache is apache 1.x00:01
sadmacKeybuk: the plot thickens...00:02
sadmacKeybuk: at any rate, its already getting ugly this idea of distro-compatible scripts00:02
sadmacKeybuk: if you force them to be in one file, you are going to see people do things with sed that you can't unsee00:03
sadmacin package post-install scripts00:03
mbieblsadmac: I think simple/trivial scripts could surely be cross-distro00:04
mbieblacipd, smartd, 00:04
mbieblatd ...00:04
sadmacmbiebl: well they're welcome to, but we aren't talking about simple, trival scripts. We're talking about /all/ scripts00:05
sadmacthis is blanket policy00:05
Keybukthings have to be upstream00:05
Keybukbecause if they're not upstream, then we have to maintain them as a divergence from Debian00:05
Keybukand that hurts00:05
Keybukif they're uniform, then upstream can put them in the tarball00:05
Keybukand Debian takes Upstart through the back door00:05
sadmacsomeone's going to be taking it through the back door alright :)00:06
sadmacI don't think it will happen00:06
sadmaceven still, I think the python syntax will make more sense anyway with the new state machine00:07
Keybukdepends00:07
KeybukI actually have a vague theory about being able to specify multiple things in one file00:07
Keybuklike if you're defining apache, you should be able to put the daily log rotation job in there too00:08
Keybukso one bit defines the daemon, then you define a different while/on clause, with a different task/service attached00:08
sadmacKeybuk: the way it is now, you could have:00:08
sadmacfoostate(bar: baz):00:08
sadmac    when something00:08
sadmacfoostate(bar: bang):00:08
sadmac    when something else00:08
sadmacKeybuk: and those conf items could apply to two different states /or both apply to the same state/00:09
sadmacKeybuk: foostate(bar: baz) will get the first when, foostate(bar: bang) gets the second, foostate(bar: baz, bar: bang) gets both00:09
ion_Real-life examples would be so much nicer. :-)00:10
sadmacion_: there's actually a good IRL one in the blog posts for this particular case00:11
sadmacmount(...):00:11
sadmac    (mount stuff here)00:11
sadmacmount(type: nfs, ...):00:11
sadmac    when network00:11
sadmacmount(type: somefusefilesystem, ...):00:11
sadmac    (non-standard mount command used)00:11
ion_Much better. :-)00:12
sadmacthe stuff under the first mount line applies to /all/ mounts.00:12
sadmacthe latter two apply only to mounts of a particular filesystem type00:12
Keybukthough that optimises the uncommon case again00:15
sadmacKeybuk: its not terribly expensive00:16
Keybukassert ( cost == 0 );00:17
sadmacKeybuk: the reason I allow the state machine to behave this way is because it would cost me extra effort not to. I'd have to explicitly state it was impossible.00:17
sadmaccost < 000:17
Keybukerr00:17
KeybukI only care about the cost to a user00:17
Keybuklike I said, we're writing an init daemon here00:18
Keybuknot a math paper00:18
sadmacin terms of implementation details its easier to write00:18
Keybukif the implementation is harder, but gives a better user experience, I'd rather go with the harder implementation00:18
sadmacI see this only as a gain00:18
sadmacI see no disadvantage other than semantics of files, which I have no interest in preserving00:19
Keybukit makes the files harder to understand00:19
Keybukyou need to know more about what's going on under the hood00:19
Keybukyou can't just do00:19
Keybukcat > /etc/init/some_service00:20
Keybukwhile ...00:20
sadmacIt looks pretty obvious to me00:20
Keybukexec ...00:20
Keybuk^D00:20
sadmacthis is what you do to mount a filesystem00:20
sadmacthis is what's different if its nfs00:20
sadmacthis is what's different if its a funky filesystem00:20
Keybukbut it isn't obvious00:20
Keybukwhat the hell is the stuff before the :00:20
Keybukis that the while clause?00:20
sadmacname of state, arguments to state00:20
Keybukwhile ...:00:20
Keybuk  ...00:20
Keybukexactly, you suddenly force everyone to define a state to define a service00:20
KeybukI don't like that00:21
sadmacif jobs /are/ states, that's kind of inherent00:21
Keybuklet's use a simple example then00:26
Keybukhow would you define the job for the dbus session bus daemon?00:26
sadmacdbus_session_daemon(%session):00:26
Keybukit runs for each instance of the x-session state00:27
sadmac    when x-session(id: %session)00:27
sadmac    auto00:27
sadmac    exec /usr/bin/dbus-session00:27
Keybukok00:27
Keybukinstead of exec, use eval - that puts the $DBUS_SESSION_BUS_ADDRESS into the job's environment00:28
Keybukthat environment variable is required for anything that depends on dbus_session_daemon00:28
Keybukmodify the definition, and show a job that depends on dbus_session_daemon and gets that address00:28
sadmacdbus_session_daemon(%session):00:28
sadmac    when x-session(id:....00:28
Keybukno ...s :p00:28
sadmac /* blah blah, skip to last line*/00:29
sadmacok00:29
sadmacdbus_session_daemon(%session):00:29
sadmac    when x-session(id: %session)00:29
sadmac    auto00:29
sadmac    eval DBUS_SESSION_BUS_ADDRESS=%session /usr/bin/dbus-session00:29
KeybukI don't understand your eval line there, could you explain it?00:30
sadmacit substitutes %session for the session argument00:30
Keybukerr, but DBUS_SESSION_BUS_ADDRESS is printed *by* dbus-session00:31
Keybukthat was my point00:31
Keybukyou run dbus-session, grab its stdout, and you get something that looks like an envvar00:31
sadmacah, I misunderstood the question00:31
Keybukinterestingly, your model is like 0.5 in its treatment of instances00:31
Keybukin that you have to explicitly define what makes a job unique00:31
Keybukin your case there, you have to say that it's unique per value of %session00:31
KeybukI assume that if you try and start one, you have to give a value for %session00:31
KeybukI'm guessing that:00:32
Keybuksingleton():00:32
sadmacKeybuk: if you start it manually yes00:32
Keybuk  exec foo00:32
Keybukcan only be run once?00:32
Keybukyou can't start multiple copies00:32
sadmacno00:32
Keybukno you can't, or no you can?00:32
sadmacyou can't00:33
sadmacyou could do something like:00:34
sadmacsingleton(%_nonce_):00:34
sadmac    exec foo00:34
sadmacwhere nonce would be some unique ID that would be filled in for you.00:34
Keybukok00:34
Keybukso let's say you wanted to run a service in a chroot00:34
Keybukor a group of services00:34
Keybukyou'd have to add %chroot to everything?00:35
sadmacdepends.00:35
sadmacif they all run in the same chroot then definitely no00:35
Keybukwhy no?00:35
KeybukI mean have a second copy of everything across two chroots00:35
Keybukfor the record, btw, my equivalent would look like:00:36
Keybukwhile x-session00:36
Keybukeval /usr/bin/dbus-launch --sh-syntax00:36
Keybukexport DBUS_SESSION_BUS_ADDRESS00:36
Keybukwhile dbus-session-bus00:36
Keybukexec /usr/bin/dbus-session-service00:36
Keybukerr00:36
Keybukwhile x-session00:36
Keybukeval /usr/bin/dbus-launch --sh-syntax00:36
Keybukexport DBUS_SESSION_BUS_ADDRESS00:36
Keybuk--00:36
Keybukwhile dbus-session-bus00:36
Keybukexec /usr/bin/dbus-session-service00:36
Keybuk--00:36
Keybukgap between the two jobs got lost there :p00:36
sadmacyou have to define 2 states?00:37
Keybukone for the dbus session bus00:37
Keybukthe other for the service you want to run on it00:37
Keybukthey're services, not states, in my model00:37
sadmacoh00:37
sadmacright00:38
sadmacok, seeing that I can answer your question00:38
sadmac    when x-session(id: %session)00:38
sadmacwait...00:38
sadmacdbus_session_daemon(%session):00:39
sadmac    when x-session(id: %session)00:39
sadmacshit. too quick on the copypasta00:39
sadmacdbus_session_daemon(%session, %busaddr):00:39
sadmac    when x-session(id: %session)00:39
sadmac    auto00:39
sadmac    busaddr := exec /usr/bin/dbus-launch --sh-syntax00:40
sadmacdbus_session_service(%busaddr):00:41
sadmac    when dbus_session_daemon(%busaddr)00:41
sadmac    auto00:41
sadmac    exec DBUS_SESSION_BUS_ADDRESS=%busaddr /usr/bin/dbus-session-service00:42
KeybukI think my way is easier :)00:42
sadmacI don't00:43
ion_In this case, Keybuk’s syntax wins.00:44
sadmacok00:44
sadmacKeybuk: how do you express the mounting case?00:44
Keybukthere's not enough info in yours to tell00:46
Keybukcould you expand yours a little00:46
sadmaclet me flesh them out00:47
sadmacmount(%mountpoint):00:47
sadmac    when file-exists(%mountpoint)00:47
sadmacdamn!00:48
* sadmac needs an irc line editor00:48
KeybukI just use vi and paste ;)00:49
sadmacyeah, doing that way now00:49
sadmacmount(%mountpoint, %devname): when file-exists(%mountpoint) exec mount %devname %mountpoint00:51
sadmacmount(auto: true): auto00:51
sadmacwow. fail00:51
sadmacmount(type: nfs): when network()00:51
sadmacmount(type: ntfs, %mountpoint, %devname): exec ntfs3g-mount %mountpoint, %devname00:51
sadmacok, that, but with linebreaks00:51
sadmacmount(%mountpoint, %devname): when file-exists(%mountpoint) exec mount %devname %mountpoint00:52
sadmacmount(auto: true): auto00:52
sadmacmount(type: nfs): when network()00:52
sadmacmount(type: ntfs, %mountpoint, %devname): exec ntfs3g-mount %mountpoint, %devname00:52
* sadmac goes to file a bug against IRSSI00:52
Keybukhmm00:52
sadmacI'll pastebin it then00:52
Keybuksurely that's wrong00:52
Keybukaccording to your own blog00:52
Keybukmount(type: nfs): ...00:52
Keybuksimply creates a state where type = nfs00:53
Keybukit doesn't bind that to any dependant states00:53
Keybukwhat you mean is00:53
sadmacKeybuk: no00:53
Keybukmount(%type):00:53
Keybuk  when ... type=nfs ?00:53
sadmacKeybuk: no00:53
Keybukno?00:53
sadmacmount(type: nfs) means that the below config items apply to all mount states such that type = nfs00:54
sadmacKeybuk: and you never create states in my model00:54
sadmacKeybuk: you just say when they'll be on00:54
Keybukoh, I see00:55
sadmacKeybuk: the syntax on my blog was designed to facillitate mathiness. It won't always resemble this00:55
Keybukerr00:56
Keybukso each ...(): is like a while clause?00:56
Keybukso00:56
Keybukdbus_session_daemon(%session):00:56
Keybuk  ...00:56
Keybukdefines both the dbus session daemon00:56
Keybuk*and*00:56
Keybuksomething that depends on the dbus session daemon?00:56
Keybukto simplify00:56
KeybukI want food to run00:57
Keybuk(heh)00:57
Keybukfoo(...):00:57
Keybuk   exec /usr/sbin/food00:57
Keybuknow I want bard to run along side that00:57
KeybukI could either do00:57
Keybukbar(...):00:57
Keybuk   when foo00:57
Keybuk   exec /usr/sbin/bard00:57
Keybukor00:57
Keybukfoo(...)00:57
Keybuk   exec /usr/sbin/bard00:57
sadmacKeybuk: those are slightly different in one way. notice how I kept the auto keyword?00:58
Keybukyes, I didn't get that00:58
sadmacKeybuk: in your first writing, it is possible to bring up foo, then bring up bar, but bringing up bar will always bring up foo.00:58
Keybukright00:58
Keybukbut it means there's two different ways to make one job run with another00:59
sadmacKeybuk: in your second example, both executables shadow the same state, so they are completely non-independant00:59
sadmacKeybuk: the second is a bad idea00:59
KeybukI'd place a bet now that the second is what most people will write ;)00:59
Keybukin fact00:59
KeybukI'd bet you that what most people will write is:00:59
Keybukrunlevel2(...):00:59
Keybuk   exec my daemon00:59
sadmacKeybuk: let me translate my dbus one into english01:00
sadmacdbus_session_daemon(%session, %busaddr):         // For a state dbus_session_daemon with arguments session and busaddr of any value01:01
Keybukoh, I think I actually understand how your model works now :)01:01
Keybukit's quite neat01:01
sadmacok.01:01
sadmaclet me stop there, because I might confuse you again :)01:02
sadmactell me what you've found01:02
Keybukyou define states01:02
Keybukand you define things to be done when a given state is true01:02
Keybuk"jobs" are the latter01:02
Keybukthe former are done by things like initctl I guess01:02
Keybukso your fstab example works because you define states for the items in fstab01:02
Keybukand the jobs defined items that are processed when those things are true01:02
Keybukfoo(...):01:03
Keybuk   exec foo01:03
Keybukfoo(...):01:03
Keybuk  when ...01:03
Keybuk  exec bar01:03
Keybukactually adds the when to both?01:03
Keybukthe when introduces the dep to foo, not to the short clip of things-to-be-done-when-foo-is-true, right?01:03
sadmacassuming the (...) is the same for both01:03
sadmacright01:03
ion_pe025244  * sadmac goes to file a bug against IRSSI01:04
sadmacion_: yeah, I should go do that01:04
ion_How about turning paste_join_multiline off?01:04
sadmacion_: good idea!01:04
KeybukI think the problem you're going to have is explaining your model in such a way that people don't do01:05
Keybukrunlevel2():01:05
Keybuk   exec my_service01:05
Keybukbecause the simplest paragraph01:05
Keybuk"BLAH: exec..." defines a service to be run while the BLAH state is true01:05
Keybukis going to tell people to do exactly that01:06
sadmacKeybuk: there is some issue there, and some of it can be fixed with more syntax, but fortunately you and I will control most of the initial usage of this :) I think that once my terse and formal self is out of the room and you open up a system defined this way and actually look at the examples it will become clear01:07
sadmacKeybuk: in the long run I don't think its terribly difficult for a sysadmin to do, even if the short term might include a bump or two. It should become natural over time.01:08
sadmacI like about this one that common sense does work quite a bit better for it than for many other models I've played with.01:08
KeybukI'd be interested to see if you could write an example page of the "writing a service" documentation01:09
* Keybuk likes writing end-user documentation as a design method01:09
sadmacI could do that.01:09
sadmacKeybuk: one of the big goals here was actually to be mathematically rigorous, and for a good reason. We're doing this rewrite because we kept finding out things about the previous mechanism that hadn't occured to us.01:11
sadmacIt may be an up hill battle explaining the minutiae of this thing, but no one will /EVER/ tell me something about it that surprises me. Its definition is thorough and complete.01:11
sadmacnotting: you missed Keybuk suddenly understanding what I've been yammering about for the past 2 months :)01:24
=== notting_ is now known as notting
geiseri_hey, how do i change the order of things in the event.d directory, i am on intrepid and my event broke because it needs to wait for hal to start.20:21
geiseri_on started hal  <- is this what i should have there?20:29
geiseri_if hal is the rc.d step?20:30

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