Python 3 compatibility fixes

Fixes on MapR plugin to fit python3 compatibility.

Story: #2005902
Task: #36069
Change-Id: Ibc9f517425b05d5e22718b0f1581c33d8b436f21
This commit is contained in:
Telles Nobrega 2019-08-21 09:53:59 -03:00
parent 7c66f91a8b
commit 8905dd368e
4 changed files with 8 additions and 9 deletions

View File

@ -77,9 +77,8 @@ class BaseNodeManager(s.AbstractNodeManager):
instances = instances or cluster_context.get_instances()
zookeepers = cluster_context.filter_instances(instances, mng.ZOOKEEPER)
cldbs = cluster_context.filter_instances(instances, mfs.CLDB)
others = filter(
lambda i: not cluster_context.check_for_process(i, mfs.CLDB),
instances)
others = [i for i in instances
if not cluster_context.check_for_process(i, mfs.CLDB)]
utils.add_provisioning_step(cluster_context.cluster.id,
_("Start ZooKeepers nodes"),
len(zookeepers))

View File

@ -135,7 +135,7 @@ class Oozie(s.Service):
@el.provision_step(_("Rebuilt Oozie war"))
def _rebuild(self, cluster_context, instances):
OOZIE.stop(filter(OOZIE.is_started, instances))
OOZIE.stop(list(filter(OOZIE.is_started, instances)))
g.execute_on_instances(
instances, self._rebuild_oozie_war, cluster_context)
OOZIE.start(instances)

View File

@ -46,7 +46,7 @@ class Swift(s.Service):
@el.provision_step("Install Swift service")
def _install_swift_jar(self, cluster_context, instances):
LOG.debug('Installing Swift jar')
jar = u.get_file_text(Swift.HADOOP_SWIFT_JAR, 'sahara_plugin_mapr')
jar = u.try_get_file_text(Swift.HADOOP_SWIFT_JAR, 'sahara_plugin_mapr')
path = '%s/swift.jar' % cluster_context.hadoop_lib
@el.provision_event()

View File

@ -233,10 +233,10 @@ def create_fake_cluster(cluster, existing, additional):
def need_upd(node_group):
return node_group.id in counts and counts[node_group.id] > 0
updated = map(update_ng, filter(need_upd, cluster.node_groups))
not_updated = filter(lambda ng:
not need_upd(ng) and ng is not None,
cluster.node_groups)
updated = list(map(update_ng, filter(need_upd, cluster.node_groups)))
not_updated = list(
filter(lambda ng: not need_upd(ng) and ng is not None,
cluster.node_groups))
cluster_dict = cluster.to_dict()
cluster_dict.update({'node_groups': updated + not_updated})
fake = r.create_cluster_resource(cluster_dict)