Bug 820395
Summary: | [RFE] Provide mechanism to execute script without Audrey Config Server | ||
---|---|---|---|
Product: | [Retired] CloudForms Cloud Engine | Reporter: | james labocki <jlabocki> |
Component: | aeolus-conductor | Assignee: | Joe Vlcek <jvlcek> |
Status: | CLOSED WORKSFORME | QA Contact: | Rehana <aeolus-qa-list> |
Severity: | low | Docs Contact: | |
Priority: | unspecified | ||
Version: | 1.0.0 | CC: | dajohnso, dcaplan, jvlcek, mitch, thunt |
Target Milestone: | rc | Keywords: | FutureFeature |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2012-05-21 13:55:26 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
james labocki
2012-05-09 19:56:47 UTC
you can do this although I don;t believe there is documentation around it... please flip it to docs if you this is what you are looking for Here is a template that installs a script which gets executed through cron to shutdown a box after no one has logged into for a hour <template> <name>RHEL6.2-rhevm</name> <os> <name>RHEL-6</name> <version>2</version> <arch>x86_64</arch> <install type="url"> <url>http://somerepo.redhat.com/released/RHEL-6/6.2/Server/x86_64/os/</url> </install> <rootpw>redhat</rootpw> </os> <repositories> <repository name="aeolus"> <url>http://somerepo.redhat.com/CloudEngine/1.0/latest/el6-engine-and-agents/x86_64/</url> <signed>False</signed> </repository> <repository name="RHEL"> <url>http://somerepo.redhat.com/released/RHEL-6/6.2/Server/x86_64/os/</url> </repository> <repository name="RHEL-optional"> <url>http://somerepo.redhat.com/released/RHEL-6/6.2/Server/optional/x86_64/os/</url> </repository> </repositories> <packages> <package name='rhev-agent'/> </packages> <description>RHEL62 x86_64 </description> <commands> <command name="auto_shutdown"> touch /etc/cron.hourly/shutdown echo '#!/bin/bash' >>/etc/cron.hourly/shutdown echo '# This will shutdown a host that is not actively being used.' >>/etc/cron.hourly/shutdown echo '# Check to make sure no one is logged in' >>/etc/cron.hourly/shutdown echo 'if [ \$(who | wc -l) -gt 0 ]' >>/etc/cron.hourly/shutdown echo 'then' >>/etc/cron.hourly/shutdown echo ' # People logged in' >>/etc/cron.hourly/shutdown echo ' echo "People are logged in: \$(who | wc -l)" | logger -p local0.notice -t charlie' >>/etc/cron.hourly/shutdown echo ' exit 1' >>/etc/cron.hourly/shutdown echo 'fi' >>/etc/cron.hourly/shutdown echo 'SAVEIFS=\$IFS' >>/etc/cron.hourly/shutdown echo 'IFS=\$(echo -en "\n\b")' >>/etc/cron.hourly/shutdown echo 'HOURS=2' >>/etc/cron.hourly/shutdown echo '. /etc/charlie.conf' >>/etc/cron.hourly/shutdown echo 'SECONDS=\$((HOURS*60*60))' >>/etc/cron.hourly/shutdown echo 'now_time=\$(date +%s)' >>/etc/cron.hourly/shutdown echo "wtmp_time=\$(ls -l --time-style='+%s' /var/log/wtmp | awk '\{ print \$6 \}')" >>/etc/cron.hourly/shutdown echo 'diff_time=\$((\$now_time - \$wtmp_time))' >>/etc/cron.hourly/shutdown echo 'if [ \$SECONDS -gt \$diff_time ]' >>/etc/cron.hourly/shutdown echo 'then' >>/etc/cron.hourly/shutdown echo ' # Someone has been logged in' >>/etc/cron.hourly/shutdown echo ' exit' >>/etc/cron.hourly/shutdown echo 'fi' >>/etc/cron.hourly/shutdown echo 'echo "No users found in the last \$HOURS hours. Shutting down" | logger -p local0.notice -t charlie' >>/etc/cron.hourly/shutdown echo 'shutdown -h +5 "No one seems to be using the system. Shutting down, saving money. Thank you"' >>/etc/cron.hourly/shutdown chmod 777 /etc/cron.hourly/shutdown </command> </commands> </template> This is related to Redmine task: 3260 CloudInit - Research allowing for config schemes which don't use confserv. There are multiple possible solutions to this issue. Some more complete but also taking more time. Others, like the one described in Comment 1, require less implementation but require more work for the user. One possible, more complete solution, could be to leverage using CloudInit Need PM Input on target release/timeframe. The author of this BZ, James Labocki, filed it on the behalf of Tim Hunt. After speaking with Tim I've realized what he is asking for is not the ability to run a script in the launching instance. Which by the way we can already do. What Tim is looking for is a way to trigger a script to run on the CloudForms/Conductor host at different phases of instance launch. This is mostly because it is nearly always possible to break out through a customer's proxy to the public address of the launching instance but it may not be possible for an instance launching in the public to get back into the customers network. This RFE as written seems to be asking for the ability to run script-age in the launching instance. Which already is possible. After talking w/Tim Hunt it is clear that what this RFE is looking for is hooks into the state machine on the Conductor side to trigger script-age to run on the Conductor side at different phases of instance launch, e.g.: the instance has just been launched, the instance is coming up, the instance has networking... To alleviate more confusion I am going to close this bug and ask the author to please open a new RFE assigning it to the Conductor team and describing more accurately what they want. |