Skip to content

[DOCS] salt-cloud and register_image function #60679

@vladaurosh

Description

@vladaurosh

Description
Hello. I am relatively new to saltstack and salt-cloud.
I am trying to use salt-cloud function register_image
https://docs.saltproject.io/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html#salt.cloud.clouds.ec2.register_image

Current documentation has one CLI example but you can't see what parameters can be passed to this function.

While CLI example works fine, it creates AMI with one block device. So I was trying to create AMI with 2 block devices, and that option is not documented. But it exists. I've looked into source code (ec2.py) and there's argument block_device_mapping.
Now, I do not know what to pass as block_device_mapping.

I've played around a bit and added this line:
block_device_mapping = {'DeviceName': '/dev/xvda','Ebs': {'SnapshotId': 'snap-111111111','VolumeType': 'gp2'}}, {'DeviceName': '/dev/sdb','Ebs': {'SnapshotId': 'snap-222222222','VolumeType': 'gp2'}}
just before
params.update(_param_from_config('BlockDeviceMapping', block_device_mapping))

And with this I was able to create AMI with 2 block devices.

Now, the issue here is that I can't pass this in CLI:
salt-cloud -f register_image my-ec2-config ami_name=new_AMI description="new ami" architecture=x86_64 root_device_name=/dev/xvda block_device_mapping={'DeviceName': '/dev/xvda','Ebs': {'SnapshotId': 'snap-111111111','VolumeType': 'gp2'}}, {'DeviceName': '/dev/sdb','Ebs': {'SnapshotId': 'snap-222222222','VolumeType': 'gp2'}}

I've tried with double/single quotes but thad didn't work as python didn't interpret this correctly.

Does anybody know why to pass block_device_mapping to salt-cloud -f register_image ?

Suggested Fix
List of parameters that can be passed to function with examples how to use them.

Type of documentation

  • Salt documentation
  • Salt modules
  • Man pages (which get autogenerated from the docs, such as salt.1 and salt.7)

Location or format of documentation
https://docs.saltproject.io/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html#salt.cloud.clouds.ec2.register_image

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationRelates to Salt documentationseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundtime-estimate-sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions