public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files
@ 2023-10-03 11:36 Aaron Lauterer
  2023-10-03 11:36 ` [pve-devel] [PATCH manager 2/2] pvereport: add interfaces.d directory Aaron Lauterer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aaron Lauterer @ 2023-10-03 11:36 UTC (permalink / raw)
  To: pve-devel

So far this hasn't been an issue as each user of dir2text wanted files
with a specific pattern. But if we want every file in the directory, we
need to skip the special files '.' and '..'.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 PVE/Report.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/Report.pm b/PVE/Report.pm
index c9109dca..435458b9 100644
--- a/PVE/Report.pm
+++ b/PVE/Report.pm
@@ -13,6 +13,7 @@ my sub dir2text {
     my $text = '';
     PVE::Tools::dir_glob_foreach($target_dir, $regexp, sub {
 	my ($file) = @_;
+	return if $file eq '.' || $file eq '..';
 	$text .=  "\n# cat $target_dir$file\n";
 	$text .= PVE::Tools::file_get_contents($target_dir.$file)."\n";
     });
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 2/2] pvereport: add interfaces.d directory
  2023-10-03 11:36 [pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Aaron Lauterer
@ 2023-10-03 11:36 ` Aaron Lauterer
  2023-10-31 11:27 ` [pve-devel] [PATCH manager 3/3] pvereport: add sdn config directory Aaron Lauterer
  2023-11-02 20:02 ` [pve-devel] applied: [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Lauterer @ 2023-10-03 11:36 UTC (permalink / raw)
  To: pve-devel

With the SDN becoming more prevalent, it is a good idea to include any
additional config files in '/etc/network/interfaces.d'.

Since no special suffix is enforced, we need to match against any file.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 PVE/Report.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/Report.pm b/PVE/Report.pm
index 435458b9..34ddd204 100644
--- a/PVE/Report.pm
+++ b/PVE/Report.pm
@@ -76,6 +76,7 @@ my $init_report_cmds = sub {
 		'ip -details -4 route show',
 		'ip -details -6 route show',
 		'cat /etc/network/interfaces',
+		sub { dir2text('/etc/network/interfaces.d/', '.*') },
 	    ],
 	},
 	firewall => {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 3/3] pvereport: add sdn config directory
  2023-10-03 11:36 [pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Aaron Lauterer
  2023-10-03 11:36 ` [pve-devel] [PATCH manager 2/2] pvereport: add interfaces.d directory Aaron Lauterer
@ 2023-10-31 11:27 ` Aaron Lauterer
  2023-11-02 20:02 ` [pve-devel] applied: [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Lauterer @ 2023-10-31 11:27 UTC (permalink / raw)
  To: pve-devel

the /etc/pve/sdn directory contains the config files, not just what they
translate to in interface configs (/etc/network/interfaces.d/snd).

The current way will also include dotifiles that may contain the
current/running state. Which can be useful to troubleshoot.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

the other 2 patches still apply, therefore I sent this as a nr 3 in this
series

 PVE/Report.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/Report.pm b/PVE/Report.pm
index 34ddd204..12d7d9a5 100644
--- a/PVE/Report.pm
+++ b/PVE/Report.pm
@@ -77,6 +77,7 @@ my $init_report_cmds = sub {
 		'ip -details -6 route show',
 		'cat /etc/network/interfaces',
 		sub { dir2text('/etc/network/interfaces.d/', '.*') },
+		sub { dir2text('/etc/pve/sdn/', '.*') },
 	    ],
 	},
 	firewall => {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files
  2023-10-03 11:36 [pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Aaron Lauterer
  2023-10-03 11:36 ` [pve-devel] [PATCH manager 2/2] pvereport: add interfaces.d directory Aaron Lauterer
  2023-10-31 11:27 ` [pve-devel] [PATCH manager 3/3] pvereport: add sdn config directory Aaron Lauterer
@ 2023-11-02 20:02 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-11-02 20:02 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer

On 03/10/2023 13:36, Aaron Lauterer wrote:
> So far this hasn't been an issue as each user of dir2text wanted files
> with a specific pattern. But if we want every file in the directory, we
> need to skip the special files '.' and '..'.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>  PVE/Report.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
>

applied, thanks!

I made an (only tangentially) related follow-up, adding a short hint
about what should get output to start of $text in dir2text, as it
seems IMO possible helpful when to get a bit more active hint that
there are no files when combing through logs.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-02 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 11:36 [pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Aaron Lauterer
2023-10-03 11:36 ` [pve-devel] [PATCH manager 2/2] pvereport: add interfaces.d directory Aaron Lauterer
2023-10-31 11:27 ` [pve-devel] [PATCH manager 3/3] pvereport: add sdn config directory Aaron Lauterer
2023-11-02 20:02 ` [pve-devel] applied: [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal