propellor 2.17.0 → 2.17.1
raw patch · 5 files changed
+64/−7 lines, 5 files
Files
- CHANGELOG +11/−0
- debian/changelog +11/−0
- propellor.cabal +1/−1
- src/Propellor/Property/Uwsgi.hs +3/−3
- src/Propellor/Ssh.hs +38/−3
CHANGELOG view
@@ -1,3 +1,14 @@+propellor (2.17.1) unstable; urgency=medium++ * Avoid generating excessively long paths to the unix socket file+ used for ssh connection caching. Mostly. Can still generate a too long+ one if $HOME is longer than 60 bytes.+ * Uwsgi: add ".ini" extension to app config files. + Files without extensions were ignored by uwsgi.+ Thanks, Félix Sipma.++ -- Joey Hess <id@joeyh.name> Mon, 28 Mar 2016 11:06:34 -0400+ propellor (2.17.0) unstable; urgency=medium * Added initial support for FreeBSD.
debian/changelog view
@@ -1,3 +1,14 @@+propellor (2.17.1) unstable; urgency=medium++ * Avoid generating excessively long paths to the unix socket file+ used for ssh connection caching. Mostly. Can still generate a too long+ one if $HOME is longer than 60 bytes.+ * Uwsgi: add ".ini" extension to app config files. + Files without extensions were ignored by uwsgi.+ Thanks, Félix Sipma.++ -- Joey Hess <id@joeyh.name> Mon, 28 Mar 2016 11:06:34 -0400+ propellor (2.17.0) unstable; urgency=medium * Added initial support for FreeBSD.
propellor.cabal view
@@ -1,5 +1,5 @@ Name: propellor-Version: 2.17.0+Version: 2.17.1 Cabal-Version: >= 1.8 License: BSD3 Maintainer: Joey Hess <id@joeyh.name>
src/Propellor/Property/Uwsgi.hs view
@@ -31,13 +31,13 @@ comment = "# deployed with propellor, do not modify" appCfg :: AppName -> FilePath-appCfg an = "/etc/uwsgi/apps-available/" ++ an+appCfg an = "/etc/uwsgi/apps-available" </> an <.> "ini" appVal :: AppName -> FilePath-appVal an = "/etc/uwsgi/apps-enabled/" ++ an+appVal an = "/etc/uwsgi/apps-enabled/" </> an <.> "ini" appValRelativeCfg :: AppName -> File.LinkTarget-appValRelativeCfg an = File.LinkTarget $ "../apps-available/" ++ an+appValRelativeCfg an = File.LinkTarget $ "../apps-available" </> an <.> "ini" installed :: Property NoInfo installed = Apt.installed ["uwsgi"]
src/Propellor/Ssh.hs view
@@ -2,9 +2,11 @@ import Propellor.Base import Utility.UserInfo+import Utility.FileSystemEncoding import System.PosixCompat import Data.Time.Clock.POSIX+import qualified Data.Hash.MD5 as MD5 -- Parameters can be passed to both ssh and scp, to enable a ssh connection -- caching socket.@@ -16,9 +18,8 @@ sshCachingParams :: HostName -> IO [CommandParam] sshCachingParams hn = do home <- myHomeDir- let cachedir = home </> ".ssh" </> "propellor"- createDirectoryIfMissing False cachedir- let socketfile = cachedir </> hn ++ ".sock"+ let socketfile = socketFile home hn+ createDirectoryIfMissing False (takeDirectory socketfile) let ps = [ Param "-o" , Param ("ControlPath=" ++ socketfile)@@ -42,3 +43,37 @@ [ Param "localhost" ] nukeFile f tenminutes = 600++-- Generate a socket filename inside the home directory.+--+-- There's a limit in the size of unix domain sockets, of approximately+-- 100 bytes. Try to never construct a filename longer than that.+--+-- When space allows, include the full hostname in the socket filename.+-- Otherwise, include at least a partial md5sum of it,+-- to avoid using the same socket file for multiple hosts.+socketFile :: FilePath -> HostName -> FilePath+socketFile home hn = selectSocketFile+ [ sshdir </> hn ++ ".sock"+ , sshdir </> hn+ , sshdir </> take 10 hn ++ "-" ++ md5+ , sshdir </> md5+ , home </> ".propellor-" ++ md5+ ]+ (".propellor-" ++ md5)+ where+ sshdir = home </> ".ssh" </> "propellor"+ md5 = take 9 $ MD5.md5s $ MD5.Str hn++selectSocketFile :: [FilePath] -> FilePath -> FilePath+selectSocketFile [] fallback = fallback+selectSocketFile [f] _ = f+selectSocketFile (f:fs) fallback+ | valid_unix_socket_path f = f+ | otherwise = selectSocketFile fs fallback++valid_unix_socket_path :: FilePath -> Bool+valid_unix_socket_path f = length (decodeW8 f) < 100 - reservedbyssh+ where+ -- ssh tacks on 17 or so characters when making a socket+ reservedbyssh = 18