Repository: libcloud Updated Branches: refs/heads/trunk 6f9b00401 -> 940e10da2
[LIBCLOUD-547] linode.py labels too long with name use linode id instead Closes #287 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/940e10da Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/940e10da Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/940e10da Branch: refs/heads/trunk Commit: 940e10da215ff40d253013bcbf10b7382dc15466 Parents: 6f9b004 Author: earthgecko <[email protected]> Authored: Tue Apr 29 16:50:07 2014 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Tue May 6 22:52:50 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 5 +++++ libcloud/compute/drivers/linode.py | 22 ++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/940e10da/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index e7af0ad..8a64df2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -118,6 +118,11 @@ Compute Note 1: "key_files" and "key_material" arguments are mutually exclusive. Note 2: "key_material" argument is not supported in the ShellOutSSHClient. +- Use node id attribute instead of the name for the "lconfig" label in the + Linode driver. This way the label is never longer than 48 characters. + (GITHUB-287) + [earthgecko] + Load Balancer ~~~~~~~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/940e10da/libcloud/compute/drivers/linode.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py index c58f56a..4960f29 100644 --- a/libcloud/compute/drivers/linode.py +++ b/libcloud/compute/drivers/linode.py @@ -284,16 +284,6 @@ class LinodeNodeDriver(NodeDriver): comments = "Created by Apache libcloud <http://www.libcloud.org>" if\ "ex_comment" not in kwargs else kwargs["ex_comment"] - # Labels - label = { - "lconfig": "[%s] Configuration Profile" % name, - "lroot": "[%s] %s Disk Image" % (name, image.name), - "lswap": "[%s] Swap Space" % name - } - for what in ["lconfig", "lroot", "lswap"]: - if what in kwargs: - label[what] = kwargs[what] - # Step 1: linode.create params = { "api_action": "linode.create", @@ -320,6 +310,18 @@ class LinodeNodeDriver(NodeDriver): } self.connection.request(API_ROOT, params=params) + # Step 1d. Labels + # use the linode id as the name can be up to 63 chars and the labels + # are limited to 48 chars + label = { + "lconfig": "[%s] Configuration Profile" % linode["id"], + "lroot": "[%s] %s Disk Image" % (linode["id"], image.name), + "lswap": "[%s] Swap Space" % linode["id"] + } + for what in ["lconfig", "lroot", "lswap"]: + if what in kwargs: + label[what] = kwargs[what] + # Step 2: linode.disk.createfromdistribution if not root: root = binascii.b2a_base64(os.urandom(8)).decode('ascii').strip()
