Bug 820395 - [RFE] Provide mechanism to execute script without Audrey Config Server
[RFE] Provide mechanism to execute script without Audrey Config Server
Product: CloudForms Cloud Engine
Classification: Red Hat
Component: aeolus-conductor (Show other bugs)
Unspecified Unspecified
unspecified Severity low
: rc
: ---
Assigned To: Joe Vlcek
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2012-05-09 15:56 EDT by james labocki
Modified: 2012-08-29 10:57 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-05-21 09:55:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description james labocki 2012-05-09 15:56:47 EDT
If a service is defined in an application blueprint it requires a config server even if there are no parameters are required for the service. This is a request to support embedding a script to run on the deployed instance when it is started.
Comment 1 Dave Johnson 2012-05-10 13:45:18 EDT
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

    <install type="url">
    <repository name="aeolus">
    <repository name="RHEL">
    <repository name="RHEL-optional">
    <package name='rhev-agent'/>
  <description>RHEL62 x86_64 </description>
    <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
Comment 2 Joe Vlcek 2012-05-10 14:27:01 EDT
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.
Comment 3 Joe Vlcek 2012-05-14 16:28:02 EDT
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.
Comment 4 Joe Vlcek 2012-05-21 09:55:26 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.