Skip to content

certificate install --file fails with TypeError due to parameter mismatch #183

@KoheiYamashita1

Description

@KoheiYamashita1

certificate_install_bug_report.md

# certificate install --file fails with TypeError due to parameter mismatch

## Summary

When running the CLI command:

```bash
vmanage --host <host> --username <user> --password <pw> certificate install --file ./VSMART.cer

The following error occurs:

TypeError: install() got an unexpected keyword argument 'file'

Cause

In vmanage/cli/certificate/install.py, the function definition uses cert instead of file:

def install(ctx, file):
    ...
    vmanage_certificate.install_device_cert(cert)  # ← this should be 'file'

Fix

Change cert to file:

vmanage_certificate.install_device_cert(file)

Additionally, to avoid a 400 Bad Request error from vManage when uploading the certificate, the CLI must read the file content rather than passing the file path string:

with open(file, 'r') as f:
    cert_content = f.read()

vmanage_certificate = Certificate(ctx.auth, ctx.host, ctx.port)
click.echo("Installing certificate...")
vmanage_certificate.install_device_cert(cert_content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions