diff options
author | Petr Oros <poros@redhat.com> | 2013-07-04 13:14:00 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-24 12:01:48 -0300 |
commit | 35ebaae6fa18a59fbfa930837f1a22978eff29eb (patch) | |
tree | b60441746d423513a11e5b4b69a16e1e399d8e3a | |
parent | bd9c06255f16259c4c9ea385bb15dc21a3140f0e (diff) | |
download | tuna-35ebaae6fa18a59fbfa930837f1a22978eff29eb.tar.gz |
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>
-rw-r--r-- | tuna/config.py | 7 |
1 files changed, 6 insertions, 1 deletions
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 @@ class Config: 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 @@ class Config: 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) |