scraperwiki/cobalt — pull request #47 by pwaller (2014-04-30 12:42:57+00:00)
Title: Userd for managing system users

Possible resolution for #46.

Potential pro:

* to tell exactly what is failing
* to test (it's a single component) synchronization is correct
* to modify without affecting other infrastructure

Potential con:

* code is more verbose
* need better monitoring infrastructure
* it's another component

```
$ go build && ./userd -cobaltHome=. -passwdDir=. -targetGroup=pwaller
[martini] listening on :3000
[martini] Started POST /users/
2014/04/30 12:22:50 Panicked making user: open passwd: no such file or directory
[martini] Completed 200 OK in 4.984349ms
[martini] Started POST /users/
2014/04/30 12:23:01 Panicked making user: chown foo: operation not permitted
[martini] Completed 200 OK in 621.057us
[martini] Started POST /status
[martini] Completed 404 Not Found in 99.927us
[martini] Started GET /status
[martini] Completed 200 OK in 308.685us
^C2014/04/30 12:24:36 SIGINT
2014/04/30 12:24:36 {
"status": "ok",
"nSuccess": "0"
"lastSuccess": "0001-01-01 00:00:00 +0000 UTC",
"sinceLastSuccess": "2562047h47m16.854775807s",
"nFailure": "2",
"lastFailure": "2014-04-30 12:23:01.868515808 +0000 UTC",
"sinceLastFailure": "1m34.515727678s",
}

```

```
$ curl -F name=foo -F uid=1234 localhost:3000/users/
{"status": "error"}
```

```
$ curl localhost:3000/status
{
"status": "ok",
"nSuccess": "0"
"lastSuccess": "0001-01-01 00:00:00 +0000 UTC",
"sinceLastSuccess": "2562047h47m16.854775807s",
"nFailure": "2",
"lastFailure": "2014-04-30 12:23:01.868515808 +0000 UTC",
"sinceLastFailure": "44.866128896s",
}
```