Commit 0944090a authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow hscan to save data for fully-spec'd URLs

In case we pass a fully-specified URL to hscan, currently it will use as
is and that means the directory in which we want to save the status
files changes from what we mean. This patch changes hscan to replace all
slashes in the cluster name with underscores when generating the output
filenames.
parent e015b554
......@@ -23,7 +23,9 @@ tools.
For each cluster, two files named \fIcluster\fB.instances\fR and
\fIcluster\fB.nodes\fR will be generated holding the instance and node
data. These files can then be used in \fBhbal\fR(1) or \fBhn1\fR(1)
via the \fB-i\fR and \fB-n\fR options.
via the \fB-i\fR and \fB-n\fR options. In case the cluster name
contains slashes (as it can happen when the cluster is a
fully-specified URL), these will be replaced with underscores.
The one-line output for each cluster will show the following:
.RS
......
......@@ -130,6 +130,11 @@ printCluster nl il ktn kti =
ccv
-- | Replace slashes with underscore for saving to filesystem
fixSlash :: String -> String
fixSlash = map (\x -> if x == '/' then '_' else x)
-- | Main function.
main :: IO ()
main = do
......@@ -170,7 +175,7 @@ main = do
putStr $ Cluster.printNodes ktn fix_nl
let ndata = serializeNodes nl csf ktn
idata = serializeInstances il csf ktn kti
oname = odir </> name
oname = odir </> (fixSlash name)
writeFile (oname <.> "nodes") ndata
writeFile (oname <.> "instances") idata)
) clusters
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment