Azure / Azure/azure-cli

az confcom katapolicygen: called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }

Open
#29,985 1 comment 2 reactions 0 assignees View on GitHub
bug customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When executed the command to generate a policy with a yaml input i got the error on some occasions.
It looks like some images have some kind of incompatibility, hence the error.
My biggest issue in this occasion is not just the failure but the non-helpfulness of the message which lead me to waste of time looking for any error on my configuration.

### Related command

az confcom katapolicygen -y deployment.yaml

```
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: namespace
spec:
serviceAccountName: workload-identity-sa
runtimeClassName: kata-cc-isolation
volumes:
- name: endor-loc
hostPath:
path: /opt/confidential-containers/share/kata-containers/reference-info-base64
containers:
- name: nginx
image: nginx:latest
command: ["/bin/sh", "-ec", "while :; do echo '.'; sleep 5 ; done"]
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
env:
- name: SkrClientKID
value:
- name: SkrClientMAAEndpoint
value: .weu.attest.azure.net
- name: SkrClientAKVEndpoint
value: .vault.azure.net
- name: skr
image: mcr.microsoft.com/aci/skr:2.7
env:
- name: SkrSideCarArgs
value:
command:
- /bin/skr
volumeMounts:
- mountPath: /opt/confidential-containers/share/kata-containers/reference-info-base64
name: endor-loc
- name: agones-gameserver-sidecar
image: us-docker.pkg.dev/agones-images/release/agones-sdk:1.43.0
env:
- name: SkrClientKID
value: key
- name: SkrClientMAAEndpoint
value: .weu.attest.azure.net
- name: SkrClientAKVEndpoint
value: .vault.azure.net
```

### Errors

thread 'main' panicked at src\registry.rs:155:56:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

### Issue script & Debug output

cli.knack.cli: Command arguments: ['confcom', 'katapolicygen', '-y', 'deployment.yaml', '--print-policy', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'confcom': ['azext_confcom']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: confcom 0.012 1 2 C:\Users\\.azure\cliextensions\confcom
cli.azure.cli.core: Total (1) 0.012 1 2
cli.azure.cli.core: Loaded 1 groups, 2 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : confcom katapolicygen
cli.azure.cli.core: Command table: confcom katapolicygen
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\\.azure\commands\2024-09-26.15-54-27.confcom_katapolicygen.3348.log'.
az_command_data_logger: command args: confcom katapolicygen -y {} --print-policy --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_sucli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x000001328D8B4A40>, .add_cache_arguments at 0x000001328D8B4B80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x000001328D8B4AE0>]
az_command_data_logger: extension name: confcom
az_command_data_logger: extension version: 0.3.6
thread 'main' panicked at src\registry.rs:155:56:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 101
cli.__main__: Command ran in 53.226 seconds (init: 0.814, invoke: 52.413)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3674 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\\.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

The command should generate the policy or, at least, provide a meaningful message stating that there is a problem with the image instead of crashing.

### Environment Summary

az --version
azure-cli 2.64.0

core 2.64.0
telemetry 1.1.0

Extensions:
aks-preview 9.0.0b2
attestation 1.0.0
confcom 0.3.6

Dependencies:
msal 1.30.0
azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\\.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

As i mentioned, it does not happen with all the images, so i am guessing that is related to the layers that are included on it.
In the provided example, the image causing the error is the one on the third container. If relevant, that same image but on version 1.33.0 works ¯\_(ツ)_/¯

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.