[augeas-devel] Re: [PATCH] Add binding for aug_mv

Free Ekanayaka free at 64studio.com
Thu Sep 4 11:05:32 UTC 2008


Hi,

the patch below actually applies to python-augeas, I hope this is the
right place to send it to.

Ciao,

Free

|--==> On Thu, 04 Sep 2008 12:42:37 +0200, Free Ekanayaka <free at 64studio.com> said:

  FE> # HG changeset patch
  FE> # User Free Ekanayaka <free at 64studio.com>
  FE> # Date 1220524789 -7200
  FE> # Node ID 09855e22210a1fd66f5a1747df7c8d0ba21c854d
  FE> # Parent  ccbfbf8439268b22fc32c35a7c9803e53cd14979
  FE> Add binding for aug_mv

  FE> diff -r ccbfbf843926 -r 09855e22210a augeas.py
  FE> --- a/augeas.py	Thu Jul 03 13:57:38 2008 +0200
  FE> +++ b/augeas.py	Thu Sep 04 12:39:49 2008 +0200
  FE> @@ -138,6 +138,26 @@ class Augeas(object):
  FE>          if ret != 0:
  FE>              raise ValueError, "Unable to set value to path!"
 
  FE> +    def move(self, src, dst):
  FE> +        """Move the node 'src' to 'dst'. 'src' must match exactly one node
  FE> +           in the tree. 'dst' must either match exactly one node in the
  FE> +           tree, or may not exist yet. If 'dst' exists already, it and all
  FE> +           its descendants are deleted before moving 'src' there. If 'dst'
  FE> +           does not exist yet, it and all its missing ancestors are created."""
  FE> +
  FE> +        # Sanity checks
  FE> +        if type(src) != str:
  FE> +            raise TypeError, "src MUST be a string!"
  FE> +        if type(dst) != str:
  FE> +            raise TypeError, "dst MUST be a string!"
  FE> +        if not self.__handle:
  FE> +            raise RuntimeError, "The Augeas object has already been closed!"
  FE> +
  FE> +        # Call the function
  FE> +        ret = Augeas._libaugeas.aug_mv(self.__handle, src, dst)
  FE> +        if ret != 0:
  FE> +            raise ValueError, "Unable to move src to dst!"
  FE> +
  FE>      def insert(self, path, label, before=True):
  FE>          """Create a new sibling 'label' for 'path' by inserting into the tree 
  FE>          just before 'path' (if 'before' is True) or just after 'path' 

  FE> _______________________________________________
  FE> augeas-devel mailing list
  FE> augeas-devel at redhat.com
  FE> https://www.redhat.com/mailman/listinfo/augeas-devel




More information about the augeas-devel mailing list