tuna: Better snapshot naming (old_file_name+stamp.conf)
Signed-off-by: Petr Oros <poros@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tuna/config.py b/tuna/config.py
index 4b7c5b9..e446447 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -37,6 +37,7 @@
self.temp.set('global', 'lastFile', filename)
with open(self.configFile, 'wb') as cfgfile:
self.temp.write(cfgfile)
+ self.config['lastfile'] = filename
def load(self, profileName):
tmp = ConfigParser.RawConfigParser()
@@ -320,7 +321,11 @@
tempconfig.set(opt, iopt, ival + out[iopt])
else:
tempconfig.set(opt, iopt, out[iopt])
- snapFileName = self.config['root']+'snapshot' + strftime("%Y-%m-%d-%H:%M:%S", localtime()) + '.conf'
+ if 'lastfile' in self.config:
+ self.name = self.config['lastfile'].replace('.conf', '')
+ else:
+ self.name = 'snapshot'
+ snapFileName = self.config['root'] + self.name + strftime("-%Y-%m-%d-%H:%M:%S", localtime()) + '.conf'
try:
with open(snapFileName , 'w') as configfile:
tempconfig.write(configfile)