summaryrefslogtreecommitdiff
path: root/doc/forum/integration_with_gitolite/comment_4_acaa1d125ea406c2a5617a4effc4b115._comment
blob: 3a02b96e93ec1600501faba87b76b9fbbab01183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[[!comment format=mdwn
 username="david"
 avatar="http://cdn.libravatar.org/avatar/22c2d800db6a7699139df604a67cb221"
 subject="getting closer"
 date="2018-08-25T17:16:48Z"
 content="""
maybe I suffer from Haskell blindness, but I didn't see how you handled keys

here's my latest revision
[[!format haskell \"\"\"
gitoliteKeys :: User -> [(FilePath, String)] -> Property UnixLike
gitoliteKeys user@(User username) keys = property' (\"set up gitolite keys for \" ++ username) $ \w -> do
      home <- liftIO (User.homedir user)
      ensureProperty w $ go home
  where
    go :: FilePath -> Property UnixLike
    go home = installKeys keys
                `onChange` recompile
                `requires` File.dirExists keydir
        where
          keydir = home </> \".gitolite/keydir/zzz/propellor\"
          recompile = Cmd.userScriptProperty user [ \"gitolite ../triggers/post-compile/ssh-authkeys\"
                                                  , \"gitolite ../triggers/post-compile/ssh-authkeys-shell-users bremner\"
                                                  ]
                      `changesFile` (home </> \"gitolite/.ssh/authorized_keys\")
          installKeys :: [(FilePath, String)] -> Property UnixLike
          installKeys [] = doNothing
          installKeys ((path, content):rest) = File.hasContent (keydir </> path ++ \".pub\") [content]
                                               `before` installKeys rest
\"\"\"]]

It still has one piece of hardcoding in it (the shell user bremner)
"""]]