On Sun, Jul 09, 2017 at 09:31:18PM +0200, Christian Boltz wrote:
> Hello,
> 
> $subject.
> 
> This is a preparation to make the next patch smaller and easier to
> read ;-)
> 
> 
> [ 02-rename-profile_storage.diff ]

Acked-by: Seth Arnold <seth.arn...@canonical.com>

Thanks

> 
> === modified file ./utils/apparmor/aa.py
> --- utils/apparmor/aa.py        2017-07-09 12:16:52.986307169 +0200
> +++ utils/apparmor/aa.py        2017-07-09 16:33:42.196851342 +0200
> @@ -428,7 +428,7 @@
>          return {local_profile: extras[local_profile]}
>      return dict()
>  
> -def profile_storage(profilename, hat, calledby):
> +def ProfileStorage(profilename, hat, calledby):
>      # keys used in aa[profile][hat]:
>      # a) rules (as dict): alias, include, lvar
>      # b) rules (as hasher): allow, deny
> @@ -458,7 +458,7 @@
>  
>  def create_new_profile(localfile, is_stub=False):
>      local_profile = hasher()
> -    local_profile[localfile] = profile_storage('NEW', localfile, 
> 'create_new_profile()')
> +    local_profile[localfile] = ProfileStorage('NEW', localfile, 
> 'create_new_profile()')
>      local_profile[localfile]['flags'] = 'complain'
>      local_profile[localfile]['include']['abstractions/base'] = 1
>  
> @@ -508,7 +454,7 @@
>          if re.search(hatglob, localfile):
>              for hat in sorted(cfg['required_hats'][hatglob].split()):
>                  if not local_profile.get(hat, False):
> -                    local_profile[hat] = profile_storage('NEW', hat, 
> 'create_new_profile() required_hats')
> +                    local_profile[hat] = ProfileStorage('NEW', hat, 
> 'create_new_profile() required_hats')
>                  local_profile[hat]['flags'] = 'complain'
>  
>      if not is_stub:
> @@ -1034,7 +980,7 @@
>  
>                  if ans == 'CMD_ADDHAT':
>                      hat = uhat
> -                    aa[profile][hat] = profile_storage(profile, hat, 
> 'handle_children addhat')
> +                    aa[profile][hat] = ProfileStorage(profile, hat, 
> 'handle_children addhat')
>                      aa[profile][hat]['flags'] = aa[profile][profile]['flags']
>                      changed[profile] = True
>                  elif ans == 'CMD_USEDEFAULT':
> @@ -1323,7 +1269,7 @@
>                              if ynans == 'y':
>                                  hat = exec_target
>                                  if not aa[profile].get(hat, False):
> -                                    aa[profile][hat] = 
> profile_storage(profile, hat, 'handle_children()')
> +                                    aa[profile][hat] = 
> ProfileStorage(profile, hat, 'handle_children()')
>                                  aa[profile][hat]['profile'] = True
>  
>                                  if profile != hat:
> @@ -1460,7 +1411,7 @@
>                      if aamode != 'merge':
>                          # Ignore log events for a non-existing profile or 
> child profile. Such events can occour
>                          # after deleting a profile or hat manually, or when 
> processing a foreign log.
> -                        # (Checking for 'file' is a simplified way to check 
> if it's a profile_storage() struct.)
> +                        # (Checking for 'file' is a simplified way to check 
> if it's a ProfileStorage.)
>                          debug_logger.debug("Ignoring events for non-existing 
> profile %s" % combine_name(profile, hat))
>                          continue
>  
> @@ -1489,10 +1440,10 @@
>                          continue  # don't ask about individual rules if the 
> user doesn't want the additional subprofile/hat
>  
>                      if log_dict[aamode][profile][hat]['profile']:
> -                        aa[profile][hat] = profile_storage(profile, hat, 
> 'mergeprof ask_the_questions() - missing subprofile')
> +                        aa[profile][hat] = ProfileStorage(profile, hat, 
> 'mergeprof ask_the_questions() - missing subprofile')
>                          aa[profile][hat]['profile'] = True
>                      else:
> -                        aa[profile][hat] = profile_storage(profile, hat, 
> 'mergeprof ask_the_questions() - missing hat')
> +                        aa[profile][hat] = ProfileStorage(profile, hat, 
> 'mergeprof ask_the_questions() - missing hat')
>                          aa[profile][hat]['profile'] = False
>  
>                  #Add the includes from the other profile to the user profile
> @@ -2023,7 +1974,7 @@
>          for profile in prelog[aamode].keys():
>              for hat in prelog[aamode][profile].keys():
>  
> -                log_dict[aamode][profile][hat] = profile_storage(profile, 
> hat, 'collapse_log()')
> +                log_dict[aamode][profile][hat] = ProfileStorage(profile, 
> hat, 'collapse_log()')
>  
>                  for path in prelog[aamode][profile][hat]['path'].keys():
>                      mode = prelog[aamode][profile][hat]['path'][path]
> @@ -2234,7 +2185,7 @@
>      if do_include:
>          profile = file
>          hat = file
> -        profile_data[profile][hat] = profile_storage(profile, hat, 
> 'parse_profile_data() do_include')
> +        profile_data[profile][hat] = ProfileStorage(profile, hat, 
> 'parse_profile_data() do_include')
>          profile_data[profile][hat]['filename'] = file
>  
>      for lineno, line in enumerate(data):
> @@ -2253,7 +2204,7 @@
>                  raise AppArmorException('Profile %(profile)s defined twice 
> in %(file)s, last found in line %(line)s' %
>                      { 'file': file, 'line': lineno + 1, 'profile': 
> combine_name(profile, hat) })
>  
> -            profile_data[profile][hat] = profile_storage(profile, hat, 
> 'parse_profile_data() profile_start')
> +            profile_data[profile][hat] = ProfileStorage(profile, hat, 
> 'parse_profile_data() profile_start')
>  
>              if attachment:
>                  profile_data[profile][hat]['attachment'] = attachment
> @@ -2529,7 +2480,7 @@
>              # if hat is already known, the filelist check some lines below 
> will error out.
>              # nevertheless, just to be sure, don't overwrite existing 
> profile_data.
>              if not profile_data[profile].get(hat, False):
> -                profile_data[profile][hat] = profile_storage(profile, hat, 
> 'parse_profile_data() hat_def')
> +                profile_data[profile][hat] = ProfileStorage(profile, hat, 
> 'parse_profile_data() hat_def')
>                  profile_data[profile][hat]['filename'] = file
>  
>              flags = matches.group('flags')
> @@ -2586,7 +2537,7 @@
>                  if re.search(hatglob, parsed_prof):
>                      for hat in cfg['required_hats'][hatglob].split():
>                          if not profile_data[parsed_prof].get(hat, False):
> -                            profile_data[parsed_prof][hat] = 
> profile_storage(parsed_prof, hat, 'parse_profile_data() required_hats')
> +                            profile_data[parsed_prof][hat] = 
> ProfileStorage(parsed_prof, hat, 'parse_profile_data() required_hats')
>  
>      # End of file reached but we're stuck in a profile
>      if profile and not do_include:
> === modified file ./utils/test/test-aa.py
> --- utils/test/test-aa.py       2017-03-03 00:10:55.506361000 +0100
> +++ utils/test/test-aa.py       2017-07-09 16:39:22.299617664 +0200
> @@ -768,7 +768,7 @@
>          self.profile_dir = '%s/profiles' % self.tmpdir
>          shutil.copytree('../../profiles/apparmor.d/', self.profile_dir, 
> symlinks=True)
>  
> -        profile = apparmor.aa.profile_storage('/test', '/test', 'test-aa.py')
> +        profile = apparmor.aa.ProfileStorage('/test', '/test', 'test-aa.py')
>  
>          # simple profile without any includes
>          profile['file'].add(FileRule.parse('owner 
> /usr/share/common-licenses/**  w,'))
> @@ -802,7 +802,7 @@
>          apparmor.aa.load_include('abstractions/enchant')
>          apparmor.aa.load_include('abstractions/aspell')
>  
> -        profile = apparmor.aa.profile_storage('/test', '/test', 'test-aa.py')
> +        profile = apparmor.aa.ProfileStorage('/test', '/test', 'test-aa.py')
>          profile['include']['abstractions/base'] = True
>          profile['include']['abstractions/bash'] = True
>          profile['include']['abstractions/enchant'] = True  # includes 
> abstractions/aspell
> @@ -842,7 +842,7 @@
>          apparmor.aa.user_globs['/usr/share/common*/foo/*'] = 
> AARE('/usr/share/common*/foo/*', True)
>          apparmor.aa.user_globs['/no/thi*ng'] = AARE('/no/thi*ng', True)
>  
> -        profile = apparmor.aa.profile_storage('/test', '/test', 'test-aa.py')
> +        profile = apparmor.aa.ProfileStorage('/test', '/test', 'test-aa.py')
>          profile['include']['abstractions/base'] = True
>          profile['include']['abstractions/bash'] = True
>          profile['include']['abstractions/enchant'] = True  # includes 
> abstractions/aspell
> 
> 

Attachment: signature.asc
Description: PGP signature

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to