AMBARI-14949: Ambaripreupload should skip uploading oozie shared lib for upgrade (jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f4e3338 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f4e3338 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f4e3338 Branch: refs/heads/2.2.1-maint Commit: 1f4e3338815cb6fe91ac1ef0f4effb53b192348c Parents: 66c35e0 Author: Jayush Luniya <jlun...@hortonworks.com> Authored: Mon Feb 8 14:36:00 2016 -0800 Committer: Jayush Luniya <jlun...@hortonworks.com> Committed: Mon Feb 8 16:10:28 2016 -0800 ---------------------------------------------------------------------- .../main/resources/scripts/Ambaripreupload.py | 31 ++++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1f4e3338/ambari-server/src/main/resources/scripts/Ambaripreupload.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/scripts/Ambaripreupload.py b/ambari-server/src/main/resources/scripts/Ambaripreupload.py index 591b7d2..5a20698 100644 --- a/ambari-server/src/main/resources/scripts/Ambaripreupload.py +++ b/ambari-server/src/main/resources/scripts/Ambaripreupload.py @@ -85,8 +85,10 @@ with Environment() as env: parser = OptionParser() parser.add_option("-v", "--hdp-version", dest="hdp_version", default="", help="hdp-version used in path of tarballs") - + parser.add_option("-u", "--upgrade", dest="upgrade", action="store_true", + help="flag to indicate script is being run for upgrade", default=False) (options, args) = parser.parse_args() + # See if hdfs path prefix is provided on the command line. If yes, use that value, if no # use empty string as default. @@ -273,19 +275,22 @@ with Environment() as env: oozie_hdfs_user_dir = format("{hdfs_path_prefix}/user/{oozie_user}") kinit_if_needed = '' - params.HdfsResource(format("{oozie_hdfs_user_dir}/share/"), - action="delete_on_execute", - type = 'directory' - ) + if options.upgrade: + Logger.info("Skipping uploading oozie shared lib during upgrade") + else: + params.HdfsResource(format("{oozie_hdfs_user_dir}/share/"), + action="delete_on_execute", + type = 'directory' + ) - params.HdfsResource(format("{oozie_hdfs_user_dir}/share"), - action="create_on_execute", - type = 'directory', - mode=0755, - recursive_chmod = True, - owner=oozie_user, - source = oozie_shared_lib, - ) + params.HdfsResource(format("{oozie_hdfs_user_dir}/share"), + action="create_on_execute", + type = 'directory', + mode=0755, + recursive_chmod = True, + owner=oozie_user, + source = oozie_shared_lib, + ) print "Copying tarballs..." copy_tarballs_to_hdfs(format("/usr/hdp/{hdp_version}/hadoop/mapreduce.tar.gz"), hdfs_path_prefix+"/hdp/apps/{{ hdp_stack_version }}/mapreduce/", 'hadoop-mapreduce-historyserver', params.mapred_user, params.hdfs_user, params.user_group)