[apparmor] [patch] move regexes from aa.py to regex.py
Christian Boltz
apparmor at cboltz.de
Thu Nov 13 17:09:00 UTC 2014
Hello,
Am Mittwoch, 12. November 2014 schrieb Steve Beattie:
> On Wed, Nov 12, 2014 at 02:42:58PM -0800, Steve Beattie wrote:
> > Another alternative would be explicitly name all the regex
> > symbols, rather than glob them in (which also makes pyflakes cry,
> > I believe).
>
> Indeed, 'make check' is failing in the utils/ directory on trunk
> because of this import:
>
> Checking apparmor
> apparmor/aa.py:43: 'from apparmor.regex import *' used; unable to
> detect undefined names Makefile:98: recipe for target 'check' failed
> make: *** [check] Error 1
>
> So we should come up with a solution for this.
As a first step, let's import them one by one to make pyflakes happy ;-)
(all listed regexes are used - confirmed by pyflakes ;-)
I have some ideas how to hide the regexes in the rule classes, but I
doubt that it will be done in the first round of the rule class patch.
[ apparmor/aa.py-import-regex-one-by-one.diff ]
=== modified file 'utils/apparmor/aa.py'
--- utils/apparmor/aa.py 2014-11-11 23:05:04 +0000
+++ utils/apparmor/aa.py 2014-11-13 16:58:34 +0000
@@ -40,7 +41,15 @@
mode_to_str_user, mode_contains, AA_OTHER,
flatten_mode, owner_flatten_mode)
-from apparmor.regex import *
+from apparmor.regex import (RE_PROFILE_START, RE_PROFILE_END, RE_PROFILE_CAP, RE_PROFILE_LINK,
+ RE_PROFILE_CHANGE_PROFILE, RE_PROFILE_ALIAS, RE_PROFILE_RLIMIT,
+ RE_PROFILE_BOOLEAN, RE_PROFILE_VARIABLE, RE_PROFILE_CONDITIONAL,
+ RE_PROFILE_CONDITIONAL_VARIABLE, RE_PROFILE_CONDITIONAL_BOOLEAN,
+ RE_PROFILE_BARE_FILE_ENTRY, RE_PROFILE_PATH_ENTRY, RE_PROFILE_NETWORK,
+ RE_NETWORK_FAMILY_TYPE, RE_NETWORK_FAMILY, RE_PROFILE_CHANGE_HAT,
+ RE_PROFILE_HAT_DEF, RE_PROFILE_DBUS, RE_PROFILE_MOUNT,
+ RE_PROFILE_SIGNAL, RE_PROFILE_PTRACE, RE_PROFILE_PIVOT_ROOT,
+ RE_PROFILE_UNIX, RE_RULE_HAS_COMMA, RE_HAS_COMMENT_SPLIT )
+
import apparmor.rules as aarules
from apparmor.yasti import SendDataToYast, GetDataFromYast, shutdown_yast
Regards,
Christian Boltz
--
After perilous fights with terrific monsters which live in our
dark dusty store rooms I have now an Epson LQ 500 printer!
[Johannes Meixner in https://bugzilla.novell.com/show_bug.cgi?id=173782]
More information about the AppArmor
mailing list