Skip to content

Commit

Permalink
add EquinixMetal to ds-identify
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
  • Loading branch information
displague committed Jun 28, 2021
1 parent 4c4d3eb commit 0d200f9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions cloudinit/apport.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'DigitalOcean',
'E24Cloud',
'GCE - Google Compute Engine',
'EquinixMetal',
'Exoscale',
'Hetzner Cloud',
'IBM - (aka SoftLayer or BlueMix)',
Expand Down
1 change: 1 addition & 0 deletions cloudinit/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'Exoscale',
'RbxCloud',
'UpCloud',
'EquinixMetal',
# At the end to act as a 'catch' when none of the above work...
'None',
],
Expand Down
10 changes: 9 additions & 1 deletion tests/unittests/test_ds_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ def test_e24cloud_not_active(self):
"""EC2: bobrightbox.com in product_serial is not brightbox'"""
self._test_ds_not_found('Ec2-E24Cloud-negative')

def test_equinixmetal_identified(self):
"""Test that Equinix Metal is identified by metadata"""
self._test_ds_found('EquinixMetal')


class TestBSDNoSys(DsIdentifyBase):
"""Test *BSD code paths
Expand Down Expand Up @@ -1136,7 +1140,11 @@ def _print_run_output(rc, out, err, cfg, files):
'Ec2-E24Cloud-negative': {
'ds': 'Ec2',
'files': {P_SYS_VENDOR: 'e24cloudyday\n'},
}
},
'EquinixMetal': {
'ds': 'EquinixMetal',
'mocks': [], # TODO how do I mock metadata responses?
},
}

# vi: ts=4 expandtab
11 changes: 10 additions & 1 deletion tools/ds-identify
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ DI_DSNAME=""
# be searched if there is no setting found in config.
DI_DSLIST_DEFAULT="MAAS ConfigDrive NoCloud AltCloud Azure Bigstep \
CloudSigma CloudStack DigitalOcean Vultr AliYun Ec2 GCE OpenNebula OpenStack \
OVF SmartOS Scaleway Hetzner IBMCloud Oracle Exoscale RbxCloud UpCloud"
OVF SmartOS Scaleway Hetzner IBMCloud Oracle Exoscale RbxCloud UpCloud \
EquinixMetal"
DI_DSLIST=""
DI_MODE=""
DI_ON_FOUND=""
Expand Down Expand Up @@ -1302,6 +1303,14 @@ dscheck_Oracle() {
return ${DS_NOT_FOUND}
}

dscheck_EquinixMetal() {
check_seed_dir "EquinixMetal" meta-data user-data && return ${DS_FOUND}
if dmi_product_name_matches "Equinix Metal"; then
return $DS_FOUND
fi
return $DS_NOT_FOUND
}

is_ibm_provisioning() {
local pcfg="${PATH_ROOT}/root/provisioningConfiguration.cfg"
local logf="${PATH_ROOT}/root/swinstall.log"
Expand Down

0 comments on commit 0d200f9

Please sign in to comment.