[elbe-devel] [PATCH v3 1/6] Add support for 'append_file' for Filesystem

Torben Hohn torben.hohn at linutronix.de
Wed May 22 16:29:43 CEST 2019


On Tue, May 21, 2019 at 02:47:15PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> 'append_file' appends content to a file and can optionally change the
> file mode.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> 

Please remove empty lines between the tags.
No need to resend... 

> Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
>  elbepack/filesystem.py | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
> index 6ced9ddb..978d32a1 100644
> --- a/elbepack/filesystem.py
> +++ b/elbepack/filesystem.py
> @@ -154,6 +154,13 @@ class Filesystem(object):
>          f.close()
>          self.chmod(path, mode)
>  
> +    def append_file(self, path, content, mode=None):
> +        f = self.open(path, "a")
> +        f.write(content)
> +        f.close()
> +        if mode is not None:
> +            self.chmod(path, mode)
> +
>      def read_file(self, path):
>          fp = self.open(path, "r")
>          retval = fp.read()
> -- 
> 2.21.0
> 

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list