summaryrefslogtreecommitdiff
path: root/doc/forum
diff options
context:
space:
mode:
authordavid2018-08-25 17:25:03 +0000
committeradmin2018-08-25 17:25:03 +0000
commit2a833de992d581276d3f7b2f60d679c15091227a (patch)
tree40fab4962b7e9bb1c7cf75c42a6e28087e541896 /doc/forum
parent9dcce408258bc08999bb1d2b798fbf12a3980137 (diff)
Added a comment: version 2
Diffstat (limited to 'doc/forum')
-rw-r--r--doc/forum/integration_with_gitolite/comment_4_448d79859b2b35e1731adfaa460aa844._comment33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/forum/integration_with_gitolite/comment_4_448d79859b2b35e1731adfaa460aa844._comment b/doc/forum/integration_with_gitolite/comment_4_448d79859b2b35e1731adfaa460aa844._comment
new file mode 100644
index 00000000..2aaacf0b
--- /dev/null
+++ b/doc/forum/integration_with_gitolite/comment_4_448d79859b2b35e1731adfaa460aa844._comment
@@ -0,0 +1,33 @@
+[[!comment format=mdwn
+ username="david"
+ avatar="http://cdn.libravatar.org/avatar/22c2d800db6a7699139df604a67cb221"
+ subject="version 2"
+ date="2018-08-25T17:25:03Z"
+ content="""
+I didn't see how you were handling keys, Sean. Did I miss something obvious or are you handling them outside propellor?
+
+Anyway, here's my second version
+[[!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 trigger POST_COMPILE\" ]
+ `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
+\"\"\"]]
+
+I spent a while talking to the gitolite author, and managed to write something more optimal than \"gitolite trigger POST_COMPILE\", but then I realized that
+had my username hardcoded into it. So it takes about 1s longer to run, but is more robust this way.
+
+"""]]