@@ -1521,11 +1521,33 @@ def callback(entity_ctx: PulpEntityContext, /) -> None:
15211521 return callback
15221522
15231523
1524+ def scan_command (** kwargs : t .Any ) -> click .Command :
1525+ """A factory that creates a scan command."""
1526+
1527+ kwargs .setdefault ("name" , "scan" )
1528+ kwargs .setdefault ("help" , _ ("Verify repository version package vulnerabilities." ))
1529+ decorators = kwargs .pop ("decorators" , [])
1530+
1531+ @pulp_command (** kwargs )
1532+ @pass_entity_context
1533+ def callback (entity_ctx : PulpEntityContext , / ) -> None :
1534+ """
1535+ Scan a {entity}.
1536+ """
1537+ entity_ctx .needs_capability ("scan" )
1538+ entity_ctx .scan ()
1539+
1540+ for option in decorators :
1541+ # Decorate callback
1542+ callback = option (callback )
1543+ return callback
1544+
1545+
15241546def version_command (** kwargs : t .Any ) -> click .Command :
15251547 """
15261548 A factory that creates a repository version command group.
15271549
1528- This group contains `list`, `show`, `destroy` and `repair ` subcommands.
1550+ This group contains `list`, `show`, `destroy`, `repair` and `scan ` subcommands.
15291551 If `list_only=True` is passed, only the `list` command will be instantiated.
15301552 Repository lookup options can be provided in `decorators`.
15311553 """
@@ -1545,6 +1567,7 @@ def callback(ctx: click.Context, repository_ctx: PulpRepositoryContext, /) -> No
15451567 if not list_only :
15461568 callback .add_command (show_command (decorators = decorators + [version_option ]))
15471569 callback .add_command (destroy_command (decorators = decorators + [version_option ]))
1570+ callback .add_command (scan_command (decorators = decorators + [version_option ]))
15481571
15491572 @callback .command ()
15501573 @repository_lookup_option
0 commit comments