Open vladaurosh opened 3 years ago
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
is the code. You are right, the documentation is poor there.
looks like you might be missing the []
's around block_device_mappings on the cli. Let me know if that fixes it.
something like
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'}}]"
@vladaurosh Following up on this one, did the solution mentioned above resolve the issue for you? Thanks!
Hello @bryceml @garethgreenaway
Sorry for late reply.
I've tried what bryceml suggested but it didn't work: [ERROR ] AWS Response Status Code and Error: [400 400 Client Error: Bad Request for url: https://ec2.eu-west-1.amazonaws.com/?Action=RegisterImage&Architecture=x86_64....] {'Errors': {'Error': {'Code': 'InvalidRequest', 'Message': 'The request received was invalid.'}}, 'RequestID': '...........'} [ERROR ] There was an error running the function: 'str' object has no attribute 'items'
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
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.