dffml icon indicating copy to clipboard operation
dffml copied to clipboard

df: overlay: Implement middleware/RBAC chains of ordered applications of overlays

Open johnandersen777 opened this issue 3 years ago • 0 comments

Enable stacking of chains of validation opertions executed in defined sequence or with ordered registred prirority via overlays. Probably done by modifying input/conditional flow of each operation with data type targeted.

  • Ref: Rolling Alice: KCP: https://github.com/liggitt/audit2rbac

Take for instance the following (off eb9eaf9fffaa59011c024f4a6fb0d05ca13bf6af)

DEBUG:dffml.MemoryOperationImplementationNetworkContext:Stage: PROCESSING: alice.cli.AlicePleaseContributeRecommendedCommunityStandardsOverlayGitHubIssue:readme_issue
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Inputs: {'repo': AliceGitRepo(directory='/tmp/tmp.jwFAqeBje6/testaa', URL=None), 'title': 'Recommended Community Standard: README', 'body': 'References:\n- https://docs.github.com/articles/about-readmes/'}
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Conditions: {}
DEBUG:dffml.AliceCliAlicepleasecontributerecommendedcommunitystandardsoverlaygithubissue:ReadmeIssueImplementationContext:Running ['gh', 'issue', 'create', '-R', None, '--title', 'Recommended Community Standard: README', '--body', 'References:\n- https://docs.github.com/articles/about-readmes/'], {}
DEBUG:dffml.MemoryOperationImplementationNetworkContext:---
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Stage: PROCESSING: alice.cli.AlicePleaseContributeRecommendedCommunityStandardsOverlayGitHubWritableRemotesFromPermissions:already_owns_repo
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Inputs: {'repo': AliceGitRepo(directory='/tmp/tmp.jwFAqeBje6/testaa', URL=None)}
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Conditions: {}
DEBUG:dffml.MemoryOperationImplementationNetworkContext:Outputs: None
DEBUG:dffml.MemoryOperationImplementationNetworkContext:---
Traceback (most recent call last):
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1277, in run_dispatch
    outputs = await self.run(
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1242, in run
    return await self.run_no_retry(ctx, octx, operation, inputs)
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1220, in run_no_retry
    outputs = await opctx.run(inputs)
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/base.py", line 544, in run
    result = await result
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/entities/alice/alice/cli.py", line 367, in readme_issue
    async for event, result in dffml.run_command_events(
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/subprocess.py", line 66, in run_command_events
    async for event, result in exec_subprocess(cmd, **kwargs):
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/subprocess.py", line 23, in exec_subprocess
    proc = await asyncio.create_subprocess_exec(*cmd, **kwargs)
  File "/usr/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/usr/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/usr/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/usr/lib/python3.9/asyncio/unix_events.py", line 789, in _start
    self._proc = subprocess.Popen(
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1756, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not NoneType

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1277, in run_dispatch
    outputs = await self.run(
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1242, in run
    return await self.run_no_retry(ctx, octx, operation, inputs)
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1220, in run_no_retry
    outputs = await opctx.run(inputs)
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/base.py", line 544, in run
    result = await result
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/entities/alice/alice/cli.py", line 333, in cli_run_on_repo
    await dffml.run_dataflow.run_custom(
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/operation/dataflow.py", line 203, in run_custom
    async for ctx, result in octx.run(subflow_inputs, parent=self.octx):
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1689, in run
    raise exception
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1857, in run_operations_for_ctx
    raise OperationException(
dffml.df.base.OperationException: alice.cli.AlicePleaseContributeRecommendedCommunityStandardsOverlayGitHubIssue:readme_issue({'repo': AliceGitRepo, 'title': ReadmeIssueTitle, 'body': ReadmeIssueBody}): {'repo': AliceGitRepo(directory='/tmp/tmp.jwFAqeBje6/testaa', URL=None), 'title': 'Recommended Community Standard: RE
ADME', 'body': 'References:\n- https://docs.github.com/articles/about-readmes/'}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pdxjohnny/.local/bin/alice", line 33, in <module>
    sys.exit(load_entry_point('alice', 'console_scripts', 'alice')())
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/cli/cmd.py", line 283, in main
    result = loop.run_until_complete(cls._main(*argv[1:]))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/cli/cmd.py", line 249, in _main
    return await cls.cli(*args)
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/cli/cmd.py", line 235, in cli
    return await cmd.do_run()
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/util/cli/cmd.py", line 213, in do_run
    return await self.run()
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/entities/alice/alice/cli.py", line 624, in run
    async for ctx, results in dffml.run(
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/high_level/dataflow.py", line 231, in run
    async for ctx, results in ctx.run(*input_sets, strict=strict):
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1689, in run
    raise exception
  File "/tmp/tmp.3ZeJVCFmag/dffml-42ed3da715f1c89b4c31d705cf7f7738f17c9306/dffml/df/memory.py", line 1857, in run_operations_for_ctx
    raise OperationException(
dffml.df.base.OperationException: alice.cli.AlicePleaseContributeRecommendedCommunityStandardsOverlayCLI:cli_run_on_repo({'repo': CLIRunOnRepo}): {'repo': '/tmp/tmp.jwFAqeBje6/testaa'}
$ git remote -v
origin  https://github.com/pdxjohnny/testaa (fetch)
origin  https://github.com/pdxjohnny/testaa (push)

johnandersen777 avatar Jun 23 '22 18:06 johnandersen777