Author: arkurth
Date: Wed May 10 21:37:15 2017
New Revision: 1794765
URL: http://svn.apache.org/viewvc?rev=1794765&view=rev
Log:
VCL-915
Added call to OS.pm::unmount_nfs_shares in Linux.pm::pre_capture.
Updated Linux.pm::add_fstab_nfs_mount to add a comment after every line it adds
to /etc/fstab that includes 'Added by VCL'.
Added calls to Linux.pm::remove_matching_fstab_lines with the argument 'Added
by VCL' to Linux.pm::pre_capture and sanitize.
Modified:
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1794765&r1=1794764&r2=1794765&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Wed May 10 21:37:15 2017
@@ -408,6 +408,10 @@ sub pre_capture {
return;
}
+ # Attempt to unmount NFS shares configured for the management node
(Site Configuration > NFS Mounts)
+ $self->unmount_nfs_shares() || return;
+ $self->remove_matching_fstab_lines('Added by VCL');
+
if ($self->can('firewall') &&
$self->firewall->can('process_pre_capture')) {
$self->firewall->process_pre_capture() || return;
}
@@ -1462,6 +1466,8 @@ sub sanitize {
# Attempt to unmount NFS shares configured for the management node
(Site Configuration > NFS Mounts)
$self->unmount_nfs_shares() || return;
+ $self->remove_matching_fstab_lines('Added by VCL');
+
notify($ERRORS{'OK'}, 0, "$computer_node_name has been sanitized");
return 1;
} ## end sub sanitize
@@ -6413,6 +6419,10 @@ sub add_fstab_nfs_mount {
return;
}
+ # Add a trailing comment to identify it was added automatically
+ my $timestamp = POSIX::strftime("%Y-%m-%d %H-%M-%S", localtime);
+ $nfs_mount_string .= "\t# Added by VCL ($timestamp)";
+
# Remove existing line matching the local mount directory followed by
"nfs" to avoid duplicate lines
$self->remove_matching_fstab_lines("$local_mount_directory nfs");
@@ -6420,7 +6430,6 @@ sub add_fstab_nfs_mount {
push @fstab_lines, $nfs_mount_string;
my $new_fstab_contents = join("\n", @fstab_lines);
- my $timestamp = POSIX::strftime("%Y-%m-%d_%H-%M-%S\n", localtime);
$self->copy_file('/etc/fstab', "/tmp/fstab.$timestamp");
if ($self->create_text_file('/etc/fstab', $new_fstab_contents)) {