Commit Graph

20 Commits

Author SHA1 Message Date
Marcus Schäfer
bdb7123fa1
Refactor use of logging facility
Use getLogger method instead of a global log object
Also use caplog fixture to capture log messages in
unit tests. This Fixes #1244
2019-10-23 17:54:27 +02:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
Marcus Schäfer
9998c2af12
Add /mnt to list of protected paths
On recursive removal make sure /mnt belong to the protected
elements. This Fixes #1170
2019-08-19 14:34:08 +02:00
Marcus Schäfer
3fd117187f
Fixed path_test unit test
The code there checked for the message of an exception
but recent changes in pytest did not allow to do it that
way anymore.
2019-07-01 11:31:20 +02:00
Marcus Schäfer
5ff6e95871
Set home as protected path
Along with adding home to the protection list, cleanup
the prepare instance cleanup code in a way that it only
runs if a root_bind object exists which needs to call
its cleanup path
2019-05-14 08:45:21 +02:00
Alberto Planas
0c095a98b1 Replace @staticmethod with @classmethod when needed
@classmethod are used in Python to represent methods that can
query and update the class (cls parameter). Is expected to be
used for metaprograming, or advanced techniques that require the
access to the class itself, before we have an instance.

@staticmethod are used to associate a function to a class. It will
not be have access to the instance (self) not the class (cls). In
other programming languages are known as class methods.

This patch replace all the @classmethod with @staticmethod when
there is not need to access to the cls parameter, because the
intention is to be used as normal functions.
2019-03-26 16:27:43 +01:00
Dan Čermák
d28a7e935c
New method: Path.access - thin wrapper arround os.access
This function calls os.access, but first checks whether the input parameters are
sane, instead of simply returning false when the file in question does not exist
or an invalid mode was specified.
2019-03-26 15:20:49 +01:00
Thomas Schraitle
3156bd14d8
Use cls in @classmethods instead of self
For consistency reasons.
2018-12-20 08:47:43 +01:00
Marcus Schäfer
75b1e2d6c7
Fixed docstring :rtype: values
In Python the string type name is str not string
2018-04-18 10:33:15 +02:00
Marcus Schäfer
41970d3dd4
Cleanup api doc strings
This cleans up and fixes the api documentation for the
public interface of the projects toplevel source code
files and Fixes #697
2018-04-16 16:10:04 +02:00
Marcus Schäfer
ccbbb48a36
Only delete sub path if not empty 2018-02-26 17:30:15 +01:00
Marcus Schäfer
d29ba29276 Add restrictions to Path.remove_hierarchy
When an iso file is used as repo, this iso will be loop mounted on
the host and bind mounted into the image root as long as the image
builds. When the mount is released a recursive cleanup of the complete
path happens. This is done by calling Path.remove_hierarchy. However
if a sub path of the mount path contains a system root directory
which is mandatory for the Linux root system it is not allowed
to be deleted even if it is empty at the time of the mount cleanup.
Thus this patch adds a lookup for protected directory names and
only runs the recursive deletion as long as no protected member
is part of the path. This fixes bsc#1080301
2018-02-12 15:56:49 +01:00
Marcus Schäfer
2fd177bd27
Better logging if Path.which doesn't find the file 2016-08-11 10:43:54 +02:00
Marcus Schäfer
f1e7984a82
Fixup Command.run if called with raise_on_error set to False 2016-08-10 21:25:04 +02:00
David Cassany
0c4256e719 Updated Command to use Path.which
Command.run and Command.call now make use of Path.which in order
to test if the command is available or not. Also Path.which has
been extended in order to support custom environments and to be
able to test file permissions (read. write, execute)
2016-08-10 16:38:33 +02:00
Marcus Schäfer
eddf0ca30e
Complete doc string for Path.which method 2016-07-07 11:37:05 +02:00
Marcus Schäfer
92899c2064
Implement Path.which
Python provides methods to do this but we can't rely on them
to be available in all python versions
2016-07-07 11:32:47 +02:00
Marcus Schäfer
e03a430f4c
Update inline API documentation 2016-04-11 16:02:29 +02:00
Marcus Schäfer
40e6308aa9 Port application from python 2.7 to 3.4
For new applications like this kiwi version and its use cases
it is better to base it on a more recent python version
2016-02-17 22:38:38 +01:00
Marcus Schäfer
09daca60c0
KIWI - appliance builder next generation
a rewrite of the current kiwi from https://github.com/openSUSE/kiwi
2015-12-05 16:17:10 +01:00