ohai
ohai copied to clipboard
Fetch the user-data on Alibaba Cloud correctly
The response of user-data
API should not be fetched line by line.
Description
On Alibaba Cloud, the response of user-data
metadata API is not processed properly.
Related Issue
#1765
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Chore (non-breaking change that does not add functionality or fix an issue)
Checklist:
- [x] I have read the CONTRIBUTING document.
- [x] I have run the pre-merge tests locally and they pass.
- [ ] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] All commits have been signed-off for the Developer Certificate of Origin.
This is my first time to coding in Ruby, I've did my best 😂. If there's any error or the coding style is not meet the repo, please just fix it, thank you.
And, in my opinion, if the purpose of this module is to ONLY retrieve the [meta-data/...](the meta-data and its sub-directory's contents), the root URL should be http://100.100.100.200/2016-01-01/meta-data/
, not http://100.100.100.200/2016-01-01/
.
If the starting point is http://100.100.100.200/2016-01-01/
(as the code here), it will also get [user-data], [dynamic/...], [global-config], [maintenance/...], these things are not [meta-data/...] related I think.
Currently the meta-data API's structure is like this, I've pasted some of the file's content after =>
http://100.100.100.200/2016-01-01/meta-data/
├── dns-conf/
│ └── nameservers => `100.100.2.136\n100.100.2.138`
├── eipv4 => ``
├── hibernation/
│ └── configured => `false`
├── hostname => `iZuf64XXXXXXXXXXXX`
├── image-id => `debian_10_9_x64_20G_alibase_20210521.vhd`
├── instance/
│ ├── instance-name => `vm-instance-name`
│ ├── instance-type => `ecs.c5.2xlarge`
│ ├── last-host-landing-time
│ ├── max-netbw-egress
│ ├── max-netbw-ingress
│ ├── virtualization-solution
│ └── virtualization-solution-version
├── instance-id
├── mac
├── network/
│ └── interfaces/
│ └── macs/
│ └── 00:11:22:xx:yy:zz/
│ ├── gateway
│ ├── netmask
│ ├── network-interface-id
│ ├── primary-ip-address
│ ├── private-ipv4s
│ ├── vpc-cidr-block
│ ├── vpc-id
│ ├── vswitch-cidr-block
│ └── vswitch-id
├── network-type
├── ntp-conf/
│ └── ntp-servers
├── owner-account-id
├── private-ipv4
├── public-keys/
│ └── 0/
│ └── openssh-key
├── ram/
│ └── security-credentials/
│ └── AnRAMRoleName
├── region-id
├── serial-number
├── source-address
├── sub-private-ipv4-list
├── vpc-cidr-block
├── vpc-id
├── vswitch-cidr-block
├── vswitch-id
└── zone-id
Thanks for the additional info @ETiV ; these changes look good.
I agree that it would make more sense to include meta-data
at the URL; that would also let us get rid of the special case for user-data
; could you make those updates?
hi @marcparadise , I just pushed a commit to apply what we've talked earlier.
@ETiV - ping?
@ETiV these changes look good to me, but we're still seeing test failures in the new specs.