pulpcore.cli.common.generic¶
pass_pulp_context
module-attribute
¶
pass_pulp_context = make_pass_decorator(PulpCLIContext)
Decorator to make the Pulp context available to a command.
pass_entity_context
module-attribute
¶
pass_entity_context = make_pass_decorator(PulpEntityContext)
Decorator to make the nearest entity context available to a command.
pass_acs_context
module-attribute
¶
pass_acs_context = make_pass_decorator(PulpACSContext)
Decorator to make the nearest ACS context available to a command.
pass_content_context
module-attribute
¶
pass_content_context = make_pass_decorator(
PulpContentContext
)
Decorator to make the nearest content context available to a command.
pass_repository_context
module-attribute
¶
pass_repository_context = make_pass_decorator(
PulpRepositoryContext
)
Decorator to make the nearest repository context available to a command.
pass_repository_version_context
module-attribute
¶
pass_repository_version_context = make_pass_decorator(
PulpRepositoryVersionContext
)
Decorator to make the nearest repository version context available to a command.
load_string_callback
module-attribute
¶
load_string_callback = load_file_wrapper(lambda c, p, x: x)
A reusable callback for text parameters.
It will read data from a file if their value starts with "@"
, otherwise use it unchanged.
load_json_callback
module-attribute
¶
load_json_callback = load_file_wrapper(json_callback)
A reusable callback that will parse its value from json.
Will optionally read from a file prefixed with "@"
.
IncompatibleContext
¶
Bases: UsageError
Exception to signal that an option or subcommand was used with an incompatible context.
ClickNoWait
¶
Bases: ClickException
Exception raised when a user interrupts waiting for a task/taskgroup.
PulpCLIContext
¶
PulpCLIContext(
api_root: str,
api_kwargs: t.Dict[str, t.Any],
background_tasks: bool,
timeout: int,
format: str,
domain: str = "default",
)
Bases: PulpContext
Subclass of the Context that overwrites the CLI specifics.
Parameters: |
|
---|
Source code in pulpcore/cli/common/generic.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
output_result
¶
output_result(result: t.Any) -> None
Dump the provided result to the console using the selected renderer.
Parameters: |
|
---|
Source code in pulpcore/cli/common/generic.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
PulpOption
¶
PulpOption(
*args: t.Any,
needs_plugins: t.Optional[
t.List[PluginRequirement]
] = None,
allowed_with_contexts: t.Optional[
t.Tuple[t.Type[PulpEntityContext]]
] = None,
**kwargs: t.Any
)
Bases: Option
Pulp-CLI specific subclass of click.Option
.
The preferred way to use this is through the
pulp_option
factory.
Source code in pulpcore/cli/common/generic.py
384 385 386 387 388 389 390 391 392 393 |
|
int_or_empty
¶
int_or_empty(value: str) -> t.Union[str, int]
Turns a string into an integer or keeps the empty string.
This is meant to be used as a click parameter type.
Source code in pulpcore/cli/common/generic.py
236 237 238 239 240 241 242 243 244 245 |
|
float_or_empty
¶
float_or_empty(value: str) -> t.Union[str, float]
Turns a string into a float or keeps the empty string.
This is meant to be used as a click parameter type.
Source code in pulpcore/cli/common/generic.py
251 252 253 254 255 256 257 258 259 260 |
|
pulp_command
¶
pulp_command(
name: t.Optional[str] = None, **kwargs: t.Any
) -> t.Callable[[_AnyCallable], PulpCommand]
Pulp command factory.
Creates a click compatible command that can be modified with needs_plugins
and
allowed_with_contexts
. It allows rendering the docstring with the values of ENTITY
and
ENTITIES
from the closest entity context.
Source code in pulpcore/cli/common/generic.py
351 352 353 354 355 356 357 358 359 360 361 |
|
pulp_group
¶
pulp_group(
name: t.Optional[str] = None, **kwargs: t.Any
) -> t.Callable[[_AnyCallable], PulpGroup]
Pulp command group factory.
Creates a click compatible group command that selects subcommands based on
allowed_with_contexts
and creates PulpCommand
subcommands by default.
Source code in pulpcore/cli/common/generic.py
364 365 366 367 368 369 370 371 372 373 |
|
load_file_wrapper
¶
load_file_wrapper(
handler: t.Callable[
[click.Context, click.Parameter, str], t.Any
]
) -> t.Any
A wrapper that is used for chaining or decorating callbacks that manipulate input data.
When prefixed with "@"
, content will be read from a file instead of being taken from the
command line.
Source code in pulpcore/cli/common/generic.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
|
json_callback
¶
json_callback(
ctx: click.Context,
param: click.Parameter,
value: t.Optional[str],
) -> t.Any
A reusable callback that will parse its value from json.
Source code in pulpcore/cli/common/generic.py
542 543 544 545 546 547 548 549 550 551 552 |
|
pulp_option
¶
pulp_option(
*args: t.Any, **kwargs: t.Any
) -> t.Callable[[FC], FC]
Factory of PulpOption
objects.
PulpOption
provides extra features over click.Option
, namely:
- Define version constrains.
- Support for template variables in the help message.
- Limit the use of options to certain entity contexts.
Examples:
Define version constrains and custom help message:
pulp_option(
"--name",
needs_plugins=[PluginRequirement("rpm", specifier=">=3.12.0")],
help=_("Name of {entity}"),
allowed_with_contexts=(PulpRpmRepositoryContext,),
)
Source code in pulpcore/cli/common/generic.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
|
list_command
¶
list_command(**kwargs: t.Any) -> click.Command
A factory that creates a list command.
Source code in pulpcore/cli/common/generic.py
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
|
show_command
¶
show_command(**kwargs: t.Any) -> click.Command
A factory that creates a show command.
Source code in pulpcore/cli/common/generic.py
1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
|
create_command
¶
create_command(**kwargs: t.Any) -> click.Command
A factory that creates a create command.
Source code in pulpcore/cli/common/generic.py
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
|
update_command
¶
update_command(**kwargs: t.Any) -> click.Command
A factory that creates an update command.
Source code in pulpcore/cli/common/generic.py
1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 |
|
destroy_command
¶
destroy_command(**kwargs: t.Any) -> click.Command
A factory that creates a destroy command.
Source code in pulpcore/cli/common/generic.py
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 |
|
version_command
¶
version_command(**kwargs: t.Any) -> click.Command
A factory that creates a repository version command group.
This group contains list
, show
, destroy
and repair
subcommands.
If list_only=True
is passed, only the list
command will be instantiated.
Repository lookup options can be provided in decorators
.
Source code in pulpcore/cli/common/generic.py
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 |
|
label_command
¶
label_command(**kwargs: t.Any) -> click.Command
A factory that creates a label command group.
This group contains set
, unset
and show
commands and acts on the nearest entity context.
Pass options in as decorators
to customize the entity lookup options.
Source code in pulpcore/cli/common/generic.py
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
|
role_command
¶
role_command(**kwargs: t.Any) -> click.Command
A factory that creates a (object) role command group.
This group contains my-permissions
, list
, add
and remove
.
Pass options in as decorators
to customize the entity lookup options.
Source code in pulpcore/cli/common/generic.py
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 |
|
repository_content_command
¶
repository_content_command(**kwargs: t.Any) -> click.Group
A factory that creates a repository content command group.
Source code in pulpcore/cli/common/generic.py
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 |
|