> On Feb. 1, 2016, 8:40 a.m., Jonathan Hurley wrote: > > ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py, > > line 81 > > <https://reviews.apache.org/r/43040/diff/2/?file=1227580#file1227580line81> > > > > Ambari typically uses the `Execute` resource for calls like this. It > > allows us to better track logging of execution of the command and some > > built-in bonuses like timeouts. > > > > Here's an example: > > Execute(kinitcmd, user=smokeuser, > > path=["/bin/", "/usr/bin/", "/usr/lib/hive/bin/", "/usr/sbin/"], > > timeout=10) > > > > Also, do you need to set any paths on this? Looks like you'll need psql > > on the path at the very least. > > Matt wrote: > Thanks for reviewing Jonathon. > > 1. Paths: I do not have to set any paths explicitly from Ambari side. All > the required paths are set by sourcing a file (the script in > HAWQ_GREENPLUM_PATH_FILE sets up all the necessary paths). > HAWQ_GREENPLUM_PATH_FILE is deployed by installing the HAWQ rpms. > > 2. Usage of Execute resource: I wanted to use the Execute resource here. > I need to get the stdout after the execution and trigger the alert based on > the value. The Execute resource expects a file in the stdout - I was not able > to get the stdout in a variable or a stringbuffer, because it expects a > fileno with the buffer that is assigned to stdout parameter. > > I will have to keep the implementation as it is now to get around this. > Do you have any other suggestions on executing commands on the host, Jonathon?
You can then use the call function inside of the shell module: For example: ``` from resource_management.core import shell code, stdout = shell.call(command, logoutput=True, quiet=False, sudo=True) ``` - Jonathan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/43040/#review117210 ----------------------------------------------------------- On Feb. 1, 2016, 8:52 p.m., Matt wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/43040/ > ----------------------------------------------------------- > > (Updated Feb. 1, 2016, 8:52 p.m.) > > > Review request for Ambari, Alexander Denissov, Alejandro Fernandez, bhuvnesh > chaudhary, Dmytro Sen, Goutam Tadi, Jaimin Jetly, jun aoki, Jonathan Hurley, > Lav Jain, Newton Alex, and Vitalyi Brodetskyi. > > > Bugs: AMBARI-14855 > https://issues.apache.org/jira/browse/AMBARI-14855 > > > Repository: ambari > > > Description > ------- > > HAWQSTANDBY can go out of sync with HAWQMASTER. Show an alert when > HAWQSTANDBY is not in sync with HAWQMASTER. > > > Diffs > ----- > > ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json > PRE-CREATION > > ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py > PRE-CREATION > ambari-server/src/test/python/stacks/2.3/HAWQ/test_alert_sync_status.py > PRE-CREATION > > Diff: https://reviews.apache.org/r/43040/diff/ > > > Testing > ------- > > Manually Tested. > Added an additional unit test. > > All unit tests passed. > > > Thanks, > > Matt > >
