[elbe-devel] [PATCH v2 1/6] Add support for 'append_file' for Filesystem
Torben Hohn
torben.hohn at linutronix.de
Mon May 20 18:17:03 CEST 2019
On Fri, May 17, 2019 at 04:36:54PM +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>
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
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
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