ソースを参照

AMBARI-18397. Update version-builder to include unique element (dlysnichenko)

Lisnichenko Dmitro 8 年 前
コミット
6c3f75e1da

+ 2 - 2
contrib/version-builder/example.py

@@ -28,8 +28,8 @@ def main(args):
 
   vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
 
-  vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0")
-  vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6")
+  vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0", "true")
+  vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", "false")
 
   vb.persist()
   vb.finalize("../../ambari-server/src/main/resources/version_definition.xsd")

+ 2 - 2
contrib/version-builder/example.sh

@@ -40,8 +40,8 @@ python version_builder.py --file $filename --available --manifest-id HDFS-271
 python version_builder.py --file $filename --os --os-family redhat6 --os-package-version 2_4_1_1_12345
 
 #call any number of times for repo per os
-python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1
-python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6
+python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 --repo-unique true
+python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 --repo-unique false
 
 
 python version_builder.py --file $filename --finalize --xsd ../../ambari-server/src/main/resources/version_definition.xsd

+ 9 - 3
contrib/version-builder/version_builder.py

@@ -173,7 +173,7 @@ class VersionBuilder:
         e = ET.SubElement(service_element, 'component')
         e.text = component
 
-  def add_repo(self, os_family, repo_id, repo_name, base_url):
+  def add_repo(self, os_family, repo_id, repo_name, base_url, unique):
     """
     Adds a repository
     """
@@ -204,6 +204,10 @@ class VersionBuilder:
     e = ET.SubElement(repo_element, 'reponame')
     e.text = repo_name
 
+    if unique is not None:
+      e = ET.SubElement(repo_element, 'unique')
+      e.text = unique
+
 
   def _check_xmllint(self):
     """
@@ -318,7 +322,7 @@ def process_repo(vb, options):
   if not options.repo:
     return
 
-  vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url)
+  vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url, options.unique)
 
 def validate_manifest(parser, options):
   """
@@ -426,11 +430,13 @@ def main(argv):
     help="The package version to use for the OS")
 
   parser.add_option('--repo', action='store_true', dest='repo',
-    help="Add repository data with options: --repo-os, --repo-url, --repo-id, --repo-name")
+    help="Add repository data with options: --repo-os, --repo-url, --repo-id, --repo-name, --repo-unique")
   parser.add_option('--repo-os', dest='repo_os',
     help="The operating system type: i.e. redhat6, redhat7, debian7, ubuntu12, ubuntu14, ubuntu16, suse11, suse12")
   parser.add_option('--repo-url', dest='repo_url',
     help="The base url for the repository data")
+  parser.add_option('--repo-unique', dest='unique', type='choice', choices=['true', 'false'],
+                    help="Indicates base url should be unique")
   parser.add_option('--repo-id', dest='repo_id', help="The ID of the repo")
   parser.add_option('--repo-name', dest='repo_name', help="The name of the repo")