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