Repository: libcloud Updated Branches: refs/heads/trunk 4e42f86bb -> b491c2db3
BUGFIX: GCE Allow the setting of service account in instance templates/instance properties Signed-off-by: Quentin Pradet <[email protected]> Closes #1108 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/11337e20 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/11337e20 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/11337e20 Branch: refs/heads/trunk Commit: 11337e2020839a65e0f0102336b614e56d32549b Parents: 4e42f86 Author: Evan Carter <[email protected]> Authored: Fri Sep 8 08:54:18 2017 -0400 Committer: Quentin Pradet <[email protected]> Committed: Fri Sep 29 09:23:12 2017 +0400 ---------------------------------------------------------------------- libcloud/compute/drivers/gce.py | 2 ++ libcloud/test/compute/test_gce.py | 6 ++++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/11337e20/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 737ed24..e5f29e7 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -4474,6 +4474,8 @@ class GCENodeDriver(NodeDriver): sa = {} if 'email' not in service_account: sa['email'] = default_email + else: + sa['email'] = service_account['email'] if 'scopes' not in service_account: sa['scopes'] = [self.AUTH_URL + default_scope] http://git-wip-us.apache.org/repos/asf/libcloud/blob/11337e20/libcloud/test/compute/test_gce.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py index 31a1bce..ef5dcc9 100644 --- a/libcloud/test/compute/test_gce.py +++ b/libcloud/test/compute/test_gce.py @@ -214,6 +214,12 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin): self.assertTrue('email' in actual) self.assertTrue('scopes' in actual) + input = {'scopes': ['compute-ro'], 'email': '[email protected]'} + actual = self.driver._build_service_account_gce_struct(input) + self.assertTrue('email' in actual) + self.assertEqual(actual['email'], '[email protected]') + self.assertTrue('scopes' in actual) + def test_build_service_account_gce_list(self): # ensure we have a list self.assertRaises(ValueError,
