#4065 build target policy failure
Closed: Fixed 2 years ago by tkopecek. Opened 2 years ago by relias-redhat.

hub policy:

channel = 
    match target some-target :: use default
    all :: use livecd

fails when attempting to apply on non-existing target.
When I call makeTask() with arg 'build_target': 'some-different-target', I get:

File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 272, in _wrap_handler
response = handler(environ)
                ^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 299, in handle_rpc
return self._dispatch(method, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/kojihub/kojixmlrpc.py", line 336, in _dispatch
ret = koji.util.call_with_argcheck(func, params, opts)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/koji/util.py", line 273, in call_with_argcheck
return func(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/kojihub/kojihub.py", line 10840, in makeTask
return make_task(*args, **opts)
         ^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/kojihub/kojihub.py", line 673, in make_task
result = ruleset.apply(policy_data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/koji/policy.py", line 408, in apply
   self.lastaction = self._apply(self.ruleset, data, top=True)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/koji/policy.py", line 381, in _apply
check = test.run(data)
           ^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/koji/policy.py", line 139, in run
if fnmatch.fnmatch(data[field], pattern):
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/fnmatch.py", line 34, in fnmatch
name = os.path.normcase(name)
           ^^^^^^^^^^^^^^^^^^^^^^
File "<frozen posixpath>", line 54, in normcase
TypeError: expected str, bytes or os.PathLike object, not NoneType

Whine one exists in this case? some-target or some-different-target?

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

2 years ago

Whine one exists in this case? some-target or some-different-target?

The one in the policy definition(some-target) may or may not exist. It fails either way if the one in makeTask args(some-different-target) doesn't exist.

Can we get full hub debug logs of the call that triggers this?

What task is being created? What are its parameters?

Can you tell us more about the environment where this happened? E.g. which koji version/ref was used?

I was able to get a similar error by passing invalid args to a build task and using the above policy.

E.g.

[mikem@localhost koji]$ ./devtools/fakehub -u mikem --pdb makeTask build '["some-srpm", "no-such-target", {}]'

I also found that I get a different error if I omit the opts parameter in the above.

  File "/home/mikem/Devel/koji/koji/kojihub/kojihub.py", line 10154, in policy_data_from_task_args
    policy_data['scratch'] = t_opts.get('scratch', False)
                             ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

I have fixed both of these in #4066

Can we get full hub debug logs of the call that triggers this?

What task is being created? What are its parameters?

Can you tell us more about the environment where this happened? E.g. which koji version/ref was used?

sorry about the delay, I'm running koji master branch with testing-ready PRs merged. It can be triggered by any arbitrary task with the invalid target specified, but I guess you've figured that out. e.g.:

makeTask(method='someMethod', arglist=[{'__method__': 'someMethod', 
    'build_target': 'fake-target'}])

Metadata Update from @mikem:
- Issue set to the milestone: 1.35

2 years ago

Metadata Update from @tkopecek:
- Issue tagged with: testing-ready

2 years ago

Metadata Update from @relias-redhat:
- Issue tagged with: testing-done

2 years ago

Log in to comment on this ticket.

Metadata
Related Pull Requests
  • #4066 Merged 2 years ago