]> xenbits.xensource.com Git - people/dariof/xen-tools.git/commitdiff
Add --extension option to xen-list-images
authorAxel Beckert <abe@deuxchevaux.org>
Thu, 17 Jan 2013 21:13:34 +0000 (22:13 +0100)
committerAxel Beckert <abe@deuxchevaux.org>
Thu, 17 Jan 2013 21:13:34 +0000 (22:13 +0100)
KNOWN_BUGS.markdown
bin/xen-list-images
debian/changelog

index 3ca772832a64723119719c1dfc6db3c8cd22b6ed..29bfdf6121b9c33ae576344a0276271e660d2e75 100644 (file)
@@ -33,8 +33,6 @@ Bugs to fix rather soon
 * `xen-create-image` says on startup summary that the Debian mirror is
   used even if Ubuntu is going to be installed (and works)
 
-* `xen-list-images` does not honour `--extension`
-
 
 Bugs to fix later
 -----------------
index a9cc39e92ef2ee6c4e1cb22c252dc06cbe9710c5..f5c6b9189293e29e874d69201b32c0bdd05f0a0b 100755 (executable)
@@ -8,6 +8,11 @@ xen-list-images - List all the created and configured Xen images.
 
   xen-list-image [options]
 
+  Filename Options:
+
+    --extension  Specify the file extension to use. An empty extension is equal
+                 to any extension.
+
   Help Options:
    --help     Show this scripts help information.
    --manual   Read this scripts manual.
@@ -95,9 +100,10 @@ use Xen::Tools::Common;
 my %CONFIG;
 
 #
-#  Default prefix
+#  Default values
 #
 $CONFIG{ 'prefix' } = "/etc/xen";
+$CONFIG{ 'extension' } = '.cfg';
 
 #
 # Release number.
@@ -162,6 +168,7 @@ sub parseCommandLineArguments
     #  Parse options.
     #
     GetOptions( "test=s", \$CONFIG{ 'prefix' },
+                "extension:s", \$CONFIG{ 'extension' },
                 "help", \$HELP,
                 "manual", \$MANUAL,
                 "version", \$VERSION );
@@ -192,9 +199,12 @@ sub findXenInstances
 {
     my @found;
 
-    foreach my $file ( sort( glob( $CONFIG{ 'prefix' } . "/*.cfg" ) ) )
+    foreach my $file ( sort( glob( $CONFIG{ 'prefix' } . "/*" . $CONFIG{ 'extension' } ) ) )
     {
-        push @found, $file if ( -e $file );
+        push @found, $file if (
+            -f $file and
+            $file !~ m(~$|\.dpkg-[a-z]+$|\.sxp$|/xl\.conf$)
+            );
     }
 
     return (@found);
index 7da699462ca6fb4fe12119015367aecb44a81d63..fa92ec1ab28bb1c55a793234128539fc1fdcc044 100644 (file)
@@ -10,6 +10,7 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
     - Also recognize "M" and "G" instead of "MB" and "GB" as size unit for
       --memory. (Closes: #691320) Document the recognized units.
     - Default DomUs to use the noop scheduler (Closes: #693131)
+    - xen-list-images now understands the --extension option.
     - Fixes "--extension=" with empty parameter.
     - Remove CVS revisions from --version output
     - Preliminary support for Debian Jessie and Ubuntu Raring