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


Fix it, then Ship it!





ambari-server/src/main/python/ambari_server/serverConfiguration.py (line 236)
<https://reviews.apache.org/r/51123/#comment212244>

    remove the parentheses aorund Exception


- Alejandro Fernandez


On Aug. 16, 2016, 2:29 a.m., Nahappan Somasundaram wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51123/
> -----------------------------------------------------------
> 
> (Updated Aug. 16, 2016, 2:29 a.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, --help            show 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.
>   --existing            LDAP 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 all required files(jdbc jar, libraries
>                         and etc), for the database type specified with the
>                         --jdbc-db option. Used only with --jdbc-db option.
>                         Archive is supported only for sqlanywhere database.
>   --jdbc-db=JDBC_DB     Specifies the database type
>                         [postgres|mysql|mssql|oracle|hsqldb|sqlanywhere] for
>                         the JDBC driver specified with the --jdbc-driver
>                         option. Used only with --jdbc-driver option.
>   --cluster-name=CLUSTER_NAME
>                         Cluster name
>   --version-display-name=DESIRED_REPO_VERSION
>                         Display name of desired repo version
>   --skip-properties-validation
>                         Skip properties file validation
>   --skip-database-check
>                         Skip database consistency check
>   --force-version       Force version to current
>   --version=STACK_VERSIONS
>                         Specify stack version that needs to be enabled. All
>                         other stacks versions will be disabled
>   --stack=STACK_NAME    Specify stack name for the stack versions that needs
>                         to be enabled
>   -d CLEANUP_FROM_DATE, --from-date=CLEANUP_FROM_DATE
>                         Specify date for the cleanup process in 'yyyy-MM-dd'
>                         format
>   --mpack=MPACK_PATH    Specified the path for management pack to be
>                         installed/upgraded
>   --purge               Purge existing resources specified in purge-list
>   --purge-list=PURGE_LIST
>                         Comma separated list of resources to purge (stack-
>                         definitions,service-definitions,mpacks). By default
>                         (stack-definitions,mpacks) will be purged.
>   --force               Force install management pack
>   --ldap-url=LDAP_URL   Primary url for LDAP
>   --ldap-secondary-url=LDAP_SECONDARY_URL
>                         Secondary url for LDAP
>   --ldap-ssl=LDAP_SSL   Use SSL [true/false] for LDAP
>   --ldap-user-class=LDAP_USER_CLASS
>                         User Attribute Object Class for LDAP
>   --ldap-user-attr=LDAP_USER_ATTR
>                         User Attribute Name for LDAP
>   --ldap-group-class=LDAP_GROUP_CLASS
>                         Group Attribute Object Class for LDAP
>   --ldap-group-attr=LDAP_GROUP_ATTR
>                         Group Attribute Name for LDAP
>   --ldap-member-attr=LDAP_MEMBER_ATTR
>                         Group Membership Attribute Name for LDAP
>   --ldap-dn=LDAP_DN     Distinguished name attribute for LDAP
>   --ldap-base-dn=LDAP_BASE_DN
>                         Base DN for LDAP
>   --ldap-manager-dn=LDAP_MANAGER_DN
>                         Manager DN for LDAP
>   --ldap-manager-password=LDAP_MANAGER_PASSWORD
>                         Manager Password For LDAP
>   --ldap-save-settings  Save without review for LDAP
>   --ldap-referral=LDAP_REFERRAL
>                         Referral method [follow/ignore] for LDAP
>   --ldap-bind-anonym=LDAP_BIND_ANONYM
>                         Bind anonymously [true/false] for LDAP
>   --ldap-sync-admin-name=LDAP_SYNC_ADMIN_NAME
>                         Username for LDAP sync
>   --ldap-sync-admin-password=LDAP_SYNC_ADMIN_PASSWORD
>                         Password for LDAP sync
>   --truststore-type=TRUST_STORE_TYPE
>                         Type of TrustStore (jks|jceks|pkcs12)
>   --truststore-path=TRUST_STORE_PATH
>                         Path of TrustStore
>   --truststore-password=TRUST_STORE_PASSWORD
>                         Password for TrustStore
>   --truststore-reconfigure
>                         Force to reconfigure TrustStore if exits
>   --security-option=SECURITY_OPTION
>                         Setup security option (setup-https|encrypt-password
>                         |setup-kerberos-jaas|setup-truststore|import-
>                         certificate)
>   --api-ssl=API_SSL     Enable SSL for Ambari API [true/false]
>   --api-ssl-port=API_SSL_PORT
>                         Client API SSL port
>   --import-cert-path=IMPORT_CERT_PATH
>                         Path to Certificate (import)
>   --import-cert-alias=IMPORT_CERT_ALIAS
>                         Alias for the imported certificate
>   --import-key-path=IMPORT_KEY_PATH
>                         Path to Private Key (import)
>   --pem-password=PEM_PASSWORD
>                         Password for Private Key
>   --master-key=MASTER_KEY
>                         Master key for encrypting passwords
>   --master-key-persist=MASTER_KEY_PERSIST
>                         Persist master key [true/false]
>   --jaas-principal=JAAS_PRINCIPAL
>                         Kerberos principal for ambari server
>   --jaas-keytab=JAAS_KEYTAB
>                         Keytab path for Kerberos principal
> 
> 
> Thanks,
> 
> Nahappan Somasundaram
> 
>

Reply via email to