Be more tolerant when selecting slaves and domains.
authorFlorian Pose <fp@igh-essen.com>
Tue, 04 Jan 2011 08:48:25 +0100
changeset 2014 1d2111370ad5
parent 2013 0aea9df5fa21
child 2015 ce2fae4d3c4f
Be more tolerant when selecting slaves and domains.
tool/Command.cpp
--- a/tool/Command.cpp	Tue Jan 04 08:39:51 2011 +0100
+++ b/tool/Command.cpp	Tue Jan 04 08:48:25 2011 +0100
@@ -339,8 +339,10 @@
         NumberListParser::List::const_iterator pi;
 
         for (pi = posList.begin(); pi != posList.end(); pi++) {
-            m.getSlave(&slave, *pi);
-            list.push_back(slave);
+            if (*pi < master.slave_count) {
+                m.getSlave(&slave, *pi);
+                list.push_back(slave);
+            }
         }
     } else { // aliases given
         SlaveAliasParser ap(master, m);
@@ -375,11 +377,6 @@
             for (pi = posList.begin(); pi != posList.end(); pi++) {
                 if (*pi < aliasSlaves.size()) {
                     list.push_back(aliasSlaves[*pi]);
-                } else {
-                    stringstream err;
-                    err << "Warning: Slave " << *ai << ":" << *pi
-                        << " does not exist on master " << m.getIndex();
-                    throwCommandException(err);
                 }
             }
         }
@@ -475,9 +472,11 @@
     NumberListParser::List::const_iterator di;
 
     for (di = domList.begin(); di != domList.end(); di++) {
-        ec_ioctl_domain_t d;
-        m.getDomain(&d, *di);
-        list.push_back(d);
+        if (*di < master.domain_count) {
+            ec_ioctl_domain_t d;
+            m.getDomain(&d, *di);
+            list.push_back(d);
+        }
     }
 
     return list;