You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Di Li <di...@ca.ibm.com> on 2015/05/22 20:28:16 UTC

Re: Review Request 34269: ambari_server/utils.py should be able to parse version with postfix text

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/34269/
-----------------------------------------------------------

(Updated May 22, 2015, 6:28 p.m.)


Review request for Ambari and Alejandro Fernandez.


Bugs: AMBARI-10968
    https://issues.apache.org/jira/browse/AMBARI-10968


Repository: ambari


Description
-------

Apache ambari 2.0 has version "2.0.0" in the version file "/var/lib/ambari-server/resources/version".

Since ambari is open source, it can be built with version information that has digits plus postfix like "2.0.0._MyCompany" in the version file "/var/lib/ambari-server/resources/version"

This postfix text causes the "ambari-server upgrade" cmd to fail with an int parser err thrown from the python script

INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
Traceback (most recent call last):
File "/usr/sbin/ambari-server.py", line 608, in <module>
mainBody()
File "/usr/sbin/ambari-server.py", line 596, in mainBody
main(options, args, parser)
File "/usr/sbin/ambari-server.py", line 562, in main
action_obj.execute()
File "/usr/sbin/ambari-server.py", line 58, in execute
self.fn(*self.args, **self.kwargs)
File "/usr/lib/python2.6/site-packages/ambari_server/serverUpgrade.py", line 320, in upgrade
elif compare_versions(ambari_version, "2.0.0") == 0:
File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 248, in compare_versions
return cmp(normalize(version1), normalize(version2))
File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 247, in normalize
return [int(x) for x in re.sub(r'(.0+)*$', '', v).split(".")]
ValueError: invalid literal for int() with base 10: '0_MyCompany'


Diffs
-----

  ambari-server/src/main/python/ambari_server/utils.py f09a95c 
  ambari-server/src/test/python/TestUtils.py bbd40bf 

Diff: https://reviews.apache.org/r/34269/diff/


Testing
-------

test_compare_versions (TestUtils.TestUtils) ... ok
... ...
----------------------------------------------------------------------
Ran 265 tests in 7.355s

OK
----------------------------------------------------------------------
Total run:773
Total errors:0
Total failures:0


Thanks,

Di Li


Re: Review Request 34269: ambari_server/utils.py should be able to parse version with postfix text

Posted by Di Li <di...@ca.ibm.com>.

> On May 22, 2015, 6:42 p.m., Alejandro Fernandez wrote:
> > Ship It!

Hello Alejandro,

Could you please help commit the change to trunk? I don't have the permission to do so.


- Di


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/34269/#review84958
-----------------------------------------------------------


On May 22, 2015, 6:28 p.m., Di Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/34269/
> -----------------------------------------------------------
> 
> (Updated May 22, 2015, 6:28 p.m.)
> 
> 
> Review request for Ambari and Alejandro Fernandez.
> 
> 
> Bugs: AMBARI-10968
>     https://issues.apache.org/jira/browse/AMBARI-10968
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Apache ambari 2.0 has version "2.0.0" in the version file "/var/lib/ambari-server/resources/version".
> 
> Since ambari is open source, it can be built with version information that has digits plus postfix like "2.0.0._MyCompany" in the version file "/var/lib/ambari-server/resources/version"
> 
> This postfix text causes the "ambari-server upgrade" cmd to fail with an int parser err thrown from the python script
> 
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> Traceback (most recent call last):
> File "/usr/sbin/ambari-server.py", line 608, in <module>
> mainBody()
> File "/usr/sbin/ambari-server.py", line 596, in mainBody
> main(options, args, parser)
> File "/usr/sbin/ambari-server.py", line 562, in main
> action_obj.execute()
> File "/usr/sbin/ambari-server.py", line 58, in execute
> self.fn(*self.args, **self.kwargs)
> File "/usr/lib/python2.6/site-packages/ambari_server/serverUpgrade.py", line 320, in upgrade
> elif compare_versions(ambari_version, "2.0.0") == 0:
> File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 248, in compare_versions
> return cmp(normalize(version1), normalize(version2))
> File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 247, in normalize
> return [int(x) for x in re.sub(r'(.0+)*$', '', v).split(".")]
> ValueError: invalid literal for int() with base 10: '0_MyCompany'
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/python/ambari_server/utils.py f09a95c 
>   ambari-server/src/test/python/TestUtils.py bbd40bf 
> 
> Diff: https://reviews.apache.org/r/34269/diff/
> 
> 
> Testing
> -------
> 
> test_compare_versions (TestUtils.TestUtils) ... ok
> ... ...
> ----------------------------------------------------------------------
> Ran 265 tests in 7.355s
> 
> OK
> ----------------------------------------------------------------------
> Total run:773
> Total errors:0
> Total failures:0
> 
> 
> Thanks,
> 
> Di Li
> 
>


Re: Review Request 34269: ambari_server/utils.py should be able to parse version with postfix text

Posted by Alejandro Fernandez <af...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/34269/#review84958
-----------------------------------------------------------

Ship it!


Ship It!

- Alejandro Fernandez


On May 22, 2015, 6:28 p.m., Di Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/34269/
> -----------------------------------------------------------
> 
> (Updated May 22, 2015, 6:28 p.m.)
> 
> 
> Review request for Ambari and Alejandro Fernandez.
> 
> 
> Bugs: AMBARI-10968
>     https://issues.apache.org/jira/browse/AMBARI-10968
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Apache ambari 2.0 has version "2.0.0" in the version file "/var/lib/ambari-server/resources/version".
> 
> Since ambari is open source, it can be built with version information that has digits plus postfix like "2.0.0._MyCompany" in the version file "/var/lib/ambari-server/resources/version"
> 
> This postfix text causes the "ambari-server upgrade" cmd to fail with an int parser err thrown from the python script
> 
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> Traceback (most recent call last):
> File "/usr/sbin/ambari-server.py", line 608, in <module>
> mainBody()
> File "/usr/sbin/ambari-server.py", line 596, in mainBody
> main(options, args, parser)
> File "/usr/sbin/ambari-server.py", line 562, in main
> action_obj.execute()
> File "/usr/sbin/ambari-server.py", line 58, in execute
> self.fn(*self.args, **self.kwargs)
> File "/usr/lib/python2.6/site-packages/ambari_server/serverUpgrade.py", line 320, in upgrade
> elif compare_versions(ambari_version, "2.0.0") == 0:
> File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 248, in compare_versions
> return cmp(normalize(version1), normalize(version2))
> File "/usr/lib/python2.6/site-packages/ambari_server/utils.py", line 247, in normalize
> return [int(x) for x in re.sub(r'(.0+)*$', '', v).split(".")]
> ValueError: invalid literal for int() with base 10: '0_MyCompany'
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/python/ambari_server/utils.py f09a95c 
>   ambari-server/src/test/python/TestUtils.py bbd40bf 
> 
> Diff: https://reviews.apache.org/r/34269/diff/
> 
> 
> Testing
> -------
> 
> test_compare_versions (TestUtils.TestUtils) ... ok
> ... ...
> ----------------------------------------------------------------------
> Ran 265 tests in 7.355s
> 
> OK
> ----------------------------------------------------------------------
> Total run:773
> Total errors:0
> Total failures:0
> 
> 
> Thanks,
> 
> Di Li
> 
>