Re: Review Request 51123: AMBARI-18152: 'ambari-server --help' not working

2016-08-16 Thread Nahappan Somasundaram


> On Aug. 16, 2016, 10:18 a.m., Alejandro Fernandez wrote:
> > ambari-server/src/main/python/ambari_server/serverConfiguration.py, line 236
> > 
> >
> > remove the parentheses aorund Exception

That's the coding style that's used in that file, so I didn't want to change 
that. We can file a "fix coding style" bug and clean up the file.


- Nahappan


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


On Aug. 15, 2016, 7:29 p.m., Nahappan Somasundaram wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51123/
> ---
> 
> (Updated Aug. 15, 2016, 7:29 p.m.)
> 
> 
> Review request for Ambari, Andrew Onischuk and Sumit Mohanty.
> 
> 
> Bugs: AMBARI-18152
> https://issues.apache.org/jira/browse/AMBARI-18152
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> ** Issue: **
> AMBARI-15300 accesses *properties* in ServerConfigDefaults::__init__() in 
> serverConfiguration.py even if get_ambari_properties() fails, resulting in an 
> exception, since *properties* is *-1* on failure.
> 
> File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", 
> line 349, in __init__
> self.PID_DIR = properties.get_property(PID_DIR_PROPERTY)
> AttributeError: 'int' object has no attribute 'get_property'
> 
> 
> ** Fix: **
> In get_ambari_properties():
> 1. Check if ROOT is available and then use it since this was the primary 
> issue (key not found).
> 2. Read the properties file in its own block of code so that we still have 
> access to the properties even if we are not able to replace $ROOT
> 3. In case of failure reading the properties file, use default properties in 
> the caller.
> 
> 
> Diffs
> -
> 
>   ambari-server/sbin/ambari-server 046ff4b3d40cdfde0d5aee52040d6996aefba08b 
>   ambari-server/src/main/python/ambari_server/serverConfiguration.py 
> 07159c3613fe5acdf8c3a65190a82b4287f2824b 
> 
> Diff: https://reviews.apache.org/r/51123/diff/
> 
> 
> Testing
> ---
> 
> ** 1. mvn test -DskipSurefireTests **
> 
> --
> Ran 267 tests in 6.698s
> 
> OK
> --
> Total run:1120
> Total errors:0
> Total failures:0
> OK
> [INFO] 
> 
> [INFO] BUILD SUCCESS
> [INFO] 
> 
> [INFO] Total time: 1:09.411s
> [INFO] Finished at: Mon Aug 15 17:48:50 PDT 2016
> [INFO] Final Memory: 56M/835M
> [INFO] 
> 
> 
> ** 2. Manual testing **
> Deployed a VM with the latest build from **trunk** and replaced  
> *serverConfiguration.py* with the one from the local build. Verified that 
> *ambari-server.py --help* works as expected:
> 
> [root@c6401 /]# ambari-server.py --help
> Usage: ambari-server.py [options] action [stack_id os]
> 
> Options:
>   -h, --helpshow this help message and exit
>   -f INIT_SCRIPT_FILE, --init-script-file=INIT_SCRIPT_FILE
> File with setup script
>   -r DROP_SCRIPT_FILE, --drop-script-file=DROP_SCRIPT_FILE
> File with drop script
>   -u UPGRADE_SCRIPT_FILE, --upgrade-script-file=UPGRADE_SCRIPT_FILE
> File with upgrade script
>   -t UPGRADE_STACK_SCRIPT_FILE, 
> --upgrade-stack-script-file=UPGRADE_STACK_SCRIPT_FILE
> File with stack upgrade script
>   -j JAVA_HOME, --java-home=JAVA_HOME
> Use specified java_home.  Must be valid on all hosts
>   -v, --verbose Print verbose status messages
>   -s, --silent  Silently accepts default prompt values
>   -g, --debug   Start ambari-server in debug mode
>   -y, --suspend-start   Freeze ambari-server Java process at startup in debug
> mode
>   --all LDAP sync all option.  Synchronize all LDAP users and
> groups.
>   --existingLDAP sync existing option.  Synchronize existing
> Ambari users and groups only.
>   --users=LDAP_SYNC_USERS
> LDAP sync users option. Specifies the path to a CSV
> file of user names to be synchronized.
>   --groups=LDAP_SYNC_GROUPS
> LDAP sync groups option.  Specifies the path to a CSV
> file of group names to be synchronized.
>   --database=DBMS   Database to use
> 

Re: Review Request 51123: AMBARI-18152: 'ambari-server --help' not working

2016-08-15 Thread Nahappan Somasundaram

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

(Updated Aug. 15, 2016, 7:29 p.m.)


Review request for Ambari, Andrew Onischuk and Sumit Mohanty.


Changes
---

Changed repr(e) to str(e)


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


Repository: ambari


Description
---

** Issue: **
AMBARI-15300 accesses *properties* in ServerConfigDefaults::__init__() in 
serverConfiguration.py even if get_ambari_properties() fails, resulting in an 
exception, since *properties* is *-1* on failure.

File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", 
line 349, in __init__
self.PID_DIR = properties.get_property(PID_DIR_PROPERTY)
AttributeError: 'int' object has no attribute 'get_property'


** Fix: **
In get_ambari_properties():
1. Check if ROOT is available and then use it since this was the primary issue 
(key not found).
2. Read the properties file in its own block of code so that we still have 
access to the properties even if we are not able to replace $ROOT
3. In case of failure reading the properties file, use default properties in 
the caller.


Diffs (updated)
-

  ambari-server/sbin/ambari-server 046ff4b3d40cdfde0d5aee52040d6996aefba08b 
  ambari-server/src/main/python/ambari_server/serverConfiguration.py 
07159c3613fe5acdf8c3a65190a82b4287f2824b 

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


Testing
---

** 1. mvn test -DskipSurefireTests **

--
Ran 267 tests in 6.698s

OK
--
Total run:1120
Total errors:0
Total failures:0
OK
[INFO] 
[INFO] BUILD SUCCESS
[INFO] 
[INFO] Total time: 1:09.411s
[INFO] Finished at: Mon Aug 15 17:48:50 PDT 2016
[INFO] Final Memory: 56M/835M
[INFO] 

** 2. Manual testing **
Deployed a VM with the latest build from **trunk** and replaced  
*serverConfiguration.py* with the one from the local build. Verified that 
*ambari-server.py --help* works as expected:

[root@c6401 /]# ambari-server.py --help
Usage: ambari-server.py [options] action [stack_id os]

Options:
  -h, --helpshow this help message and exit
  -f INIT_SCRIPT_FILE, --init-script-file=INIT_SCRIPT_FILE
File with setup script
  -r DROP_SCRIPT_FILE, --drop-script-file=DROP_SCRIPT_FILE
File with drop script
  -u UPGRADE_SCRIPT_FILE, --upgrade-script-file=UPGRADE_SCRIPT_FILE
File with upgrade script
  -t UPGRADE_STACK_SCRIPT_FILE, 
--upgrade-stack-script-file=UPGRADE_STACK_SCRIPT_FILE
File with stack upgrade script
  -j JAVA_HOME, --java-home=JAVA_HOME
Use specified java_home.  Must be valid on all hosts
  -v, --verbose Print verbose status messages
  -s, --silent  Silently accepts default prompt values
  -g, --debug   Start ambari-server in debug mode
  -y, --suspend-start   Freeze ambari-server Java process at startup in debug
mode
  --all LDAP sync all option.  Synchronize all LDAP users and
groups.
  --existingLDAP sync existing option.  Synchronize existing
Ambari users and groups only.
  --users=LDAP_SYNC_USERS
LDAP sync users option. Specifies the path to a CSV
file of user names to be synchronized.
  --groups=LDAP_SYNC_GROUPS
LDAP sync groups option.  Specifies the path to a CSV
file of group names to be synchronized.
  --database=DBMS   Database to use
embedded|oracle|mysql|mssql|postgres|sqlanywhere
  --databasehost=DATABASE_HOST
Hostname of database server
  --databaseport=DATABASE_PORT
Database port
  --databasename=DATABASE_NAME
Database/Service name or ServiceID
  --postgresschema=POSTGRES_SCHEMA
Postgres database schema name
  --databaseusername=DATABASE_USERNAME
Database user login
  --databasepassword=DATABASE_PASSWORD
Database user password
  --sidorsname=SID_OR_SNAME
Oracle database identifier type, Service ID/Service
Name sid|sname
  --sqla-server-name=SQLA_SERVER_NAME
SQL Anywhere server name
  --jdbc-driver=JDBC_DRIVER
Specifies the path to the JDBC driver JAR file or
archive with