3956c3
From dcdb2961701ccb0025c8ab45fe76fbaa27ba8133 Mon Sep 17 00:00:00 2001
20a859
From: Scott Moser <smoser@brickies.net>
20a859
Date: Fri, 24 Feb 2017 14:19:20 -0500
20a859
Subject: [PATCH 3/5] Identify Brightbox as an Ec2 datasource user.
20a859
20a859
Brightbox will identify their platform to the guest by setting the
20a859
product serial to a string that ends with 'brightbox.com'.
20a859
20a859
LP: #1661693
20a859
(cherry picked from commit 5dd5b2cb539a84ed59f2b3181020d2bd18989718)
20a859
3956c3
Resolves: rhbz#1482547
20a859
20a859
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
20a859
---
20a859
 cloudinit/sources/DataSourceEc2.py | 8 +++++++-
20a859
 1 file changed, 7 insertions(+), 1 deletion(-)
20a859
20a859
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
20a859
index 26da263a..c7df8060 100644
20a859
--- a/cloudinit/sources/DataSourceEc2.py
20a859
+++ b/cloudinit/sources/DataSourceEc2.py
20a859
@@ -30,6 +30,7 @@ STRICT_ID_DEFAULT = "warn"
20a859
 class Platforms(object):
20a859
     ALIYUN = "AliYun"
20a859
     AWS = "AWS"
20a859
+    BRIGHTBOX = "Brightbox"
20a859
     SEEDED = "Seeded"
20a859
     UNKNOWN = "Unknown"
20a859
 
20a859
@@ -325,10 +326,15 @@ def identify_aws(data):
20a859
     return None
20a859
 
20a859
 
20a859
+def identify_brightbox(data):
20a859
+    if data['serial'].endswith('brightbox.com'):
20a859
+        return Platforms.BRIGHTBOX
20a859
+
20a859
+
20a859
 def identify_platform():
20a859
     # identify the platform and return an entry in Platforms.
20a859
     data = _collect_platform_data()
20a859
-    checks = (identify_aws, lambda x: Platforms.UNKNOWN)
20a859
+    checks = (identify_aws, identify_brightbox, lambda x: Platforms.UNKNOWN)
20a859
     for checker in checks:
20a859
         try:
20a859
             result = checker(data)
20a859
-- 
20a859
2.13.5
20a859