]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added helper function
authorArvin Schnell <aschnell@suse.de>
Mon, 8 May 2017 18:21:58 +0000 (20:21 +0200)
committerArvin Schnell <aschnell@suse.de>
Mon, 8 May 2017 18:21:58 +0000 (20:21 +0200)
client/proxy.cc
client/proxy.h
client/snapper.cc

index e94a0287621e94e091479d522748f6edb036a04b..ce156d0c73ab67b36d2597d8df163397dcf71aaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 SUSE LLC
+ * Copyright (c) [2016-2017] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -55,6 +55,19 @@ ProxyConfig::getValue(const string& key, string& value) const
 }
 
 
+SMD
+ProxySnapshot::getSmd() const
+{
+    SMD smd;
+
+    smd.description = getDescription();
+    smd.cleanup = getCleanup();
+    smd.userdata = getUserdata();
+
+    return smd;
+}
+
+
 ProxySnapshots::iterator
 ProxySnapshots::find(unsigned int num)
 {
index d851af63e97b1e99efee2f279534e845ec2c0bc9..ae15a2c59f5029af1e34063d1c3a18febfff264c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 SUSE LLC
+ * Copyright (c) [2016-2017] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -103,6 +103,8 @@ public:
     const string& getCleanup() const { return impl->getCleanup(); }
     const map<string, string>& getUserdata() const { return impl->getUserdata(); }
 
+    SMD getSmd() const;
+
     bool isCurrent() const { return impl->isCurrent(); }
 
     void mountFilesystemSnapshot(bool user_request) const
index 28ae9d60878c62b294cca9fe0fe144022a4df4de..a1385c4568250b226ffa4a14e78231e7c3b9ad9c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) [2011-2015] Novell, Inc.
- * Copyright (c) 2016 SUSE LLC
+ * Copyright (c) [2016-2017] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -706,24 +706,18 @@ command_modify(ProxySnappers* snappers, ProxySnapper* snapper)
     {
        ProxySnapshots::iterator snapshot = snapshots.findNum(getopts.popArg());
 
-       SMD smd;
+       SMD smd = snapshot->getSmd();
 
        GetOpts::parsed_opts::const_iterator opt;
 
        if ((opt = opts.find("description")) != opts.end())
            smd.description = opt->second;
-       else
-           smd.description = snapshot->getDescription();
 
        if ((opt = opts.find("cleanup-algorithm")) != opts.end())
            smd.cleanup = opt->second;
-       else
-           smd.cleanup = snapshot->getCleanup();
 
        if ((opt = opts.find("userdata")) != opts.end())
            smd.userdata = read_userdata(opt->second, snapshot->getUserdata());
-       else
-           smd.userdata = snapshot->getUserdata();
 
        snapper->modifySnapshot(snapshot, smd);
     }