[Stgt-devel] [PATCH 2/7] Add option to delete all the targets

Tomasz Chmielewski mangoo
Fri Jul 25 12:46:40 CEST 2008


Doron Shoham schrieb:
> Add -d flag.
> Delete all the targets and backup the current conf file

(...)

> +# Delete all the targets and backup the current conf file
> +sub delete {
> +	print "deleting targets...\n";
> +	print "a copy of the conf file is on:/etc/tgt/targets.conf.bkp\n";
> +	`mv $configfile /etc/tgt/targets.conf.bkp`;
> +	open FILE, ">", "$configfile" or die $!;
> +	print FILE "<target>\n";
> +	print FILE "</target>\n";

It essentially removes our config file if we accidentally run this 
command twice in a row.
I wouldn't be very happy if I lost configuration of dozens of targets...


Why are we touching the config file here anyway?
IMO, "-d" flag should just remove all targets from a running tgtd; it 
shouldn't try to backup or modify the config file.


-- 
Tomasz Chmielewski
http://wpkg.org



More information about the stgt mailing list