You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2018/08/06 20:41:47 UTC

[ambari] branch trunk updated: AMBARI-24409. Infra Solr migration: Restore collection fails after EU on Custom Users + WE cluster. Error - Permission denied: u'/tmp/ranger/restore_core_pairs.json' (#1974)

This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d3b47d0  AMBARI-24409. Infra Solr migration: Restore collection fails after EU on Custom Users + WE cluster. Error - Permission denied: u'/tmp/ranger/restore_core_pairs.json' (#1974)
d3b47d0 is described below

commit d3b47d0fe8bd0ecfabba1b472d99def263310fdf
Author: Olivér Szabó <ol...@gmail.com>
AuthorDate: Mon Aug 6 22:41:44 2018 +0200

    AMBARI-24409. Infra Solr migration: Restore collection fails after EU on Custom Users + WE cluster. Error - Permission denied: u'/tmp/ranger/restore_core_pairs.json' (#1974)
---
 .../AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
index e9119c9..311fc0a 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/command_commons.py
@@ -26,7 +26,7 @@ import traceback
 
 from resource_management.core.shell import call
 from resource_management.core.logger import Logger
-from resource_management.core.resources.system import Execute
+from resource_management.core.resources.system import Execute, File
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -267,8 +267,7 @@ def __get_domain_name(url):
 
 def write_core_file(core, core_data):
   core_json_location = format("{index_location}/{core}.json")
-  with open(core_json_location, 'w') as outfile:
-    json.dump(core_data, outfile)
+  File(core_json_location, content=json.dumps(core_data))
 
 def create_core_pairs(original_cores, new_cores):
   """
@@ -286,8 +285,7 @@ def create_core_pairs(original_cores, new_cores):
       value['target_core']=new_cores[index][0]
       value['target_host']=new_cores[index][1]
       core_pairs_data.append(value)
-    with open(format("{index_location}/restore_core_pairs.json"), 'w') as outfile:
-      json.dump(core_pairs_data, outfile)
+    File(format("{index_location}/restore_core_pairs.json"), content=json.dumps(core_pairs_data))
     return core_pairs_data
 
 def sort_core_host_pairs(host_core_map):