ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-16909. VDF builder script and XSD should be updated for package-version changes (ncole)
Date Thu, 26 May 2016 19:57:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 55b265407 -> 237a906e7


AMBARI-16909. VDF builder script and XSD should be updated for package-version changes (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/237a906e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/237a906e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/237a906e

Branch: refs/heads/branch-2.4
Commit: 237a906e727e940b4419a225433e7b540ab95620
Parents: 55b2654
Author: Nate Cole <ncole@hortonworks.com>
Authored: Thu May 26 15:57:26 2016 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Thu May 26 15:57:26 2016 -0400

----------------------------------------------------------------------
 .../src/main/resources/version_definition.xsd   |  2 ++
 contrib/version-builder/example.py              |  2 +-
 contrib/version-builder/example.sh              |  4 +++
 contrib/version-builder/version_builder.py      | 37 ++++++++++++++++++--
 4 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/237a906e/ambari-server/src/main/resources/version_definition.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/version_definition.xsd b/ambari-server/src/main/resources/version_definition.xsd
index 8c20c06..1c57e90 100644
--- a/ambari-server/src/main/resources/version_definition.xsd
+++ b/ambari-server/src/main/resources/version_definition.xsd
@@ -34,6 +34,7 @@
      <xs:element name="compatible-with" type="xs:string" minOccurs="0"/>
      <xs:element name="release-notes" type="xs:string" maxOccurs="1" />
      <xs:element name="display" type="xs:string" minOccurs="0" />
+     <!-- deprecated and will be removed -->
      <xs:element name="package-version" type="xs:string" minOccurs="0" />
     </xs:all>
   </xs:complexType>
@@ -113,6 +114,7 @@
       <xs:element name="os" maxOccurs="unbounded">
         <xs:complexType>
           <xs:sequence>
+            <xs:element name="package-version" minOccurs="0" />
             <xs:element name="repo" maxOccurs="unbounded">
               <xs:complexType>
                 <xs:sequence>

http://git-wip-us.apache.org/repos/asf/ambari/blob/237a906e/contrib/version-builder/example.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.py b/contrib/version-builder/example.py
index dd719bc..b9cdf56 100644
--- a/contrib/version-builder/example.py
+++ b/contrib/version-builder/example.py
@@ -24,7 +24,7 @@ def main(args):
 
   vb.set_release(type='STANDARD', stack="HDP-2.4", version="2.4.2.0", build="2468",
     notes="http://example.com", display="HDP-2.4.2.0-2468", compatible="2.4.[0-9]+")
-  vb.set_release(package_version="2_4_2_0_*")
+  vb.set_os("redhat6", package_version="2_4_2_0_12345")
 
   vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/237a906e/contrib/version-builder/example.sh
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.sh b/contrib/version-builder/example.sh
index 4c37dda..bc76fd0 100755
--- a/contrib/version-builder/example.sh
+++ b/contrib/version-builder/example.sh
@@ -36,10 +36,14 @@ python version_builder.py --file $filename --manifest --manifest-id HBASE-132
--
 #call any number of times for the target services to upgrade
 python version_builder.py --file $filename --available --manifest-id HDFS-271
 
+# must be before repo calls
+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 --finalize --xsd ../../ambari-server/src/main/resources/version_definition.xsd
 
 # to upload this to running Ambari instance on localhost:

http://git-wip-us.apache.org/repos/asf/ambari/blob/237a906e/contrib/version-builder/version_builder.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/version_builder.py b/contrib/version-builder/version_builder.py
index 2e3fc7f..415e940 100644
--- a/contrib/version-builder/version_builder.py
+++ b/contrib/version-builder/version_builder.py
@@ -75,7 +75,7 @@ class VersionBuilder:
       print(stderr.decode("UTF-8"))
 
   def set_release(self, type=None, stack=None, version=None, build=None, notes=None, display=None,
-    compatible=None, package_version=None):
+    compatible=None):
     """
     Create elements of the 'release' parent
     """
@@ -105,8 +105,21 @@ class VersionBuilder:
     if display:
       update_simple(release_element, "display", display)
 
+  def set_os(self, os_family, package_version=None):
+    repo_parent = self.root_element.find("./repository-info")
+    if repo_parent is None:
+      raise Exception("'repository-info' element is not found")
+
+    os_element = self.findByAttributeValue(repo_parent, "./os", "family", os_family)
+    if os_element is None:
+      os_element = ET.SubElement(repo_parent, 'os')
+      os_element.set('family', os_family)
+
     if package_version:
-      update_simple(release_element, "package-version", package_version)
+      pv_element = os_element.find("package-version")
+      if pv_element is None:
+        pv_element = ET.SubElement(os_element, "package-version")
+      pv_element.text = package_version
 
 
   def add_manifest(self, id, service_name, version, version_id = None):
@@ -291,6 +304,12 @@ def process_available(vb, options):
   vb.add_available(options.manifest_id, options.available_components)
 
 
+def process_os(vb, options):
+  if not options.os:
+    return
+
+  vb.set_os(options.os_family, options.os_package_version)
+
 def process_repo(vb, options):
   """
   Processes repository options.  This method doesn't update or create individual elements,
it
@@ -329,6 +348,13 @@ def validate_available(parser, options):
   if not options.manifest_id:
     parser.error("When specifying --available, --manifest-id is also required")
 
+def validate_os(parser, options):
+  if not options.os:
+    return
+
+  if not options.os_family:
+    parser.error("When specifying --os, --os-family is also required")
+
 def validate_repo(parser, options):
   """
   Validates repo options from the command line
@@ -394,6 +420,11 @@ def main(argv):
     help="A CSV of service components that are intended to be upgraded via patch. \
       Omitting this implies the entire service should be upgraded")
 
+  parser.add_option('--os', action='store_true', dest='os', help="Add OS data with options
--os-family, --os-package-version")
+  parser.add_option('--os-family', dest='os_family', help="The operating system: i.e redhat7,
debian7, ubuntu12, ubuntu14, suse11, suse12")
+  parser.add_option('--os-package-version', dest='os_package_version',
+    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")
   parser.add_option('--repo-os', dest='repo_os',
@@ -415,6 +446,7 @@ def main(argv):
 
   validate_manifest(parser, options)
   validate_available(parser, options)
+  validate_os(parser, options)
   validate_repo(parser, options)
 
   vb = VersionBuilder(options.filename)
@@ -422,6 +454,7 @@ def main(argv):
   process_release(vb, options)
   process_manifest(vb, options)
   process_available(vb, options)
+  process_os(vb, options)
   process_repo(vb, options)
 
   # save file


Mime
View raw message