From 65b06df4574f3ed3905413eb238ce640894f09e8 Mon Sep 17 00:00:00 2001 From: Martin Hoffmann Date: Fri, 7 Jun 2024 16:22:39 +0200 Subject: [PATCH 1/3] Add --no-motd to and remove -l from rsync options. --- doc/manual/source/manual-page.rst | 16 ++++++++-------- src/collector/rsync.rs | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/manual/source/manual-page.rst b/doc/manual/source/manual-page.rst index fdb751b6..47650064 100644 --- a/doc/manual/source/manual-page.rst +++ b/doc/manual/source/manual-page.rst @@ -1083,14 +1083,14 @@ All values can be overridden via the command line options. default is simply *rsync*. rsync-args - A list of strings containing the arguments to be passed to the - rsync command. Each string is an argument of its own. - - If this option is not provided, Routinator will try to find out - if your rsync understands the ``--contimeout`` option and, if so, - will set it to 10 thus letting connection attempts time out after - ten seconds. If your rsync is too old to support this option, no - arguments are used. + A list of strings containing additional arguments to be passed + to the rsync command. Each string is an argument of its own. + + The options ``-rtzO --delete`` are always passed to the command. + The options listed in the option are added to it. + + If the option is not provided, will add ``--contimeout=10`` if + that is supported by the rsync command and ``--no-motd`` always. rsync-timeout An integer value specifying the number seconds an rsync command diff --git a/src/collector/rsync.rs b/src/collector/rsync.rs index ede3fba3..88cbd63a 100644 --- a/src/collector/rsync.rs +++ b/src/collector/rsync.rs @@ -478,6 +478,7 @@ impl RsyncCommand { if let Some(max_size) = config.max_object_size { args.push(format!("--max-size={}", max_size)); } + args.push("--no-motd".into()); args } }; @@ -618,7 +619,7 @@ impl RsyncCommand { for item in &self.args { cmd.arg(item); } - cmd.arg("-rltz") + cmd.arg("-rtzO") .arg("--delete") .arg(source.to_string()) .arg(destination); From 68a125b000a1950a86281a527cf153d058071e7d Mon Sep 17 00:00:00 2001 From: Martin Hoffmann Date: Fri, 7 Jun 2024 16:27:19 +0200 Subject: [PATCH 2/3] Fix the rsync-args documentation. --- doc/manual/source/manual-page.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/manual/source/manual-page.rst b/doc/manual/source/manual-page.rst index 47650064..a4b3b13a 100644 --- a/doc/manual/source/manual-page.rst +++ b/doc/manual/source/manual-page.rst @@ -1089,8 +1089,10 @@ All values can be overridden via the command line options. The options ``-rtzO --delete`` are always passed to the command. The options listed in the option are added to it. - If the option is not provided, will add ``--contimeout=10`` if - that is supported by the rsync command and ``--no-motd`` always. + If the option is not provided, will add ``--contimeout=10``, if + it is supported by the rsync command, `--max-size` if the + ``max-object-size`` option has not been set to 0, and + ``--no-motd`` always. rsync-timeout An integer value specifying the number seconds an rsync command From 07153f7badf385b8ba0cd0e913317016ff19d9ca Mon Sep 17 00:00:00 2001 From: Martin Hoffmann Date: Mon, 10 Jun 2024 13:01:10 +0200 Subject: [PATCH 3/3] Move -z to the default options. --- doc/manual/source/manual-page.rst | 10 +++++----- src/collector/rsync.rs | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/manual/source/manual-page.rst b/doc/manual/source/manual-page.rst index a4b3b13a..bc2b072b 100644 --- a/doc/manual/source/manual-page.rst +++ b/doc/manual/source/manual-page.rst @@ -1086,13 +1086,13 @@ All values can be overridden via the command line options. A list of strings containing additional arguments to be passed to the rsync command. Each string is an argument of its own. - The options ``-rtzO --delete`` are always passed to the command. + The options ``-rtO --delete`` are always passed to the command. The options listed in the option are added to it. - If the option is not provided, will add ``--contimeout=10``, if - it is supported by the rsync command, `--max-size` if the - ``max-object-size`` option has not been set to 0, and - ``--no-motd`` always. + If the option is not provided, Routinator will add ``-z`` and + ``--no-motd``, as well as ``--contimeout=10`` if it is supported + by the rsync command, and ``--max-size`` if the + ``max-object-size`` option has not been set to 0. rsync-timeout An integer value specifying the number seconds an rsync command diff --git a/src/collector/rsync.rs b/src/collector/rsync.rs index 88cbd63a..6f7034c9 100644 --- a/src/collector/rsync.rs +++ b/src/collector/rsync.rs @@ -469,6 +469,8 @@ impl RsyncCommand { Some(ref args) => args.clone(), None => { let mut args = Vec::new(); + args.push("--no-motd".into()); + args.push("-z".into()); let has_contimeout = output.stdout.windows(12) .any(|window| window == b"--contimeout"); @@ -478,7 +480,6 @@ impl RsyncCommand { if let Some(max_size) = config.max_object_size { args.push(format!("--max-size={}", max_size)); } - args.push("--no-motd".into()); args } }; @@ -619,7 +620,7 @@ impl RsyncCommand { for item in &self.args { cmd.arg(item); } - cmd.arg("-rtzO") + cmd.arg("-rtO") .arg("--delete") .arg(source.to_string()) .arg(destination);