summaryrefslogtreecommitdiff
path: root/cloudinit/sources/__init__.py
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-21 17:15:30 -0500
committerGitHub <noreply@github.com>2020-01-21 17:15:30 -0500
commit8c4fd886931abcf2cc8627a47463907d655b35c3 (patch)
tree5abcf1140d58c0498da01fa746d5581558423d2c /cloudinit/sources/__init__.py
parent0562ca696fe1a36b6c3b2fb576068e05033f6f3f (diff)
downloadvyos-cloud-init-8c4fd886931abcf2cc8627a47463907d655b35c3.tar.gz
vyos-cloud-init-8c4fd886931abcf2cc8627a47463907d655b35c3.zip
Start removing dependency on six (#178)
* url_helper: drop six * url_helper: sort imports * log: drop six * log: sort imports * handlers/__init__: drop six * handlers/__init__: sort imports * user_data: drop six * user_data: sort imports * sources/__init__: drop six * sources/__init__: sort imports * DataSourceOVF: drop six * DataSourceOVF: sort imports * sources/helpers/openstack: drop six * sources/helpers/openstack: sort imports * mergers/m_str: drop six This also allowed simplification of the logic, as we will never encounter a non-string text type. * type_utils: drop six * mergers/m_dict: drop six * mergers/m_list: drop six * cmd/query: drop six * mergers/__init__: drop six * net/cmdline: drop six * reporting/handlers: drop six * reporting/handlers: sort imports
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r--cloudinit/sources/__init__.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index e6baf8f4..dd93cfd8 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -9,21 +9,19 @@
# This file is part of cloud-init. See LICENSE file for license information.
import abc
-from collections import namedtuple
import copy
import json
import os
-import six
+from collections import namedtuple
-from cloudinit.atomic_helper import write_json
from cloudinit import importer
from cloudinit import log as logging
from cloudinit import net
-from cloudinit.event import EventType
from cloudinit import type_utils
from cloudinit import user_data as ud
from cloudinit import util
-
+from cloudinit.atomic_helper import write_json
+from cloudinit.event import EventType
from cloudinit.filters import launch_index
from cloudinit.reporting import events
@@ -136,8 +134,7 @@ URLParams = namedtuple(
'URLParms', ['max_wait_seconds', 'timeout_seconds', 'num_retries'])
-@six.add_metaclass(abc.ABCMeta)
-class DataSource(object):
+class DataSource(metaclass=abc.ABCMeta):
dsmode = DSMODE_NETWORK
default_locale = 'en_US.UTF-8'
@@ -436,7 +433,7 @@ class DataSource(object):
return self._cloud_name
if self.metadata and self.metadata.get(METADATA_CLOUD_NAME_KEY):
cloud_name = self.metadata.get(METADATA_CLOUD_NAME_KEY)
- if isinstance(cloud_name, six.string_types):
+ if isinstance(cloud_name, str):
self._cloud_name = cloud_name.lower()
else:
self._cloud_name = self._get_cloud_name().lower()
@@ -718,8 +715,8 @@ def normalize_pubkey_data(pubkey_data):
if not pubkey_data:
return keys
- if isinstance(pubkey_data, six.string_types):
- return str(pubkey_data).splitlines()
+ if isinstance(pubkey_data, str):
+ return pubkey_data.splitlines()
if isinstance(pubkey_data, (list, set)):
return list(pubkey_data)
@@ -729,7 +726,7 @@ def normalize_pubkey_data(pubkey_data):
# lp:506332 uec metadata service responds with
# data that makes boto populate a string for 'klist' rather
# than a list.
- if isinstance(klist, six.string_types):
+ if isinstance(klist, str):
klist = [klist]
if isinstance(klist, (list, set)):
for pkey in klist:
@@ -837,7 +834,7 @@ def convert_vendordata(data, recurse=True):
"""
if not data:
return None
- if isinstance(data, six.string_types):
+ if isinstance(data, str):
return data
if isinstance(data, list):
return copy.deepcopy(data)