You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by chris snow <ch...@gmail.com> on 2014/04/18 20:47:41 UTC

'/tools/puppet3-agent/config.sh' - make capable of being called from another script?

config.sh is expected to be run manually by a user where the user
provides the necessary input.

It would be good if config.sh could also be run with parameters, e.g.

./config.sh --service-name php --puppet-master-ip 192.168.1.1
--puppet-master-hostname puppet.test.org

This will be useful when using a tool such as packer [1] or veewee [2]
to build a cartridge?

I'm happy to create a JIRA and make this change (probably  for 4.1).

WDYT?

---
[1] http://www.packer.io/
[2] https://github.com/jedi4ever/veewee

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by Akila Ravihansa Perera <ra...@wso2.com>.
Hi Chris,

The ${RM} ... command is there to ensure that lock file is cleared and
Stratos agent will be started by Puppet. The Puppet script will start
Stratos agent only if this lock file is not present. Check
"incubator-stratos/tools/puppet3/modules/agent/manifests/start.pp" for more
details.

As a quick fix, you could check whether if this file exists before removing
it.

The reason for adding that wait_for_puppet function is to wait until Puppet
agent is in a ready state. I got this Puppet agent process is already
running error when I tried to execute config script on my laptop which has
OpenStack running on a VM.

But I don't really understand why this check for the lock file has come to
agent Puppet module (puppet3/modules/agent/manifests/start.pp). Shouldn't
we check for the Agent's lock file in Agent's stratos sh script? If a
spawned instance is restarted for some reason, Puppet won't start the Agent
process since wso2carbon.lck is present. It doesn't make sense to run
config script manually each time an instance is restarted.

Can someone explain the reason for adding this check to Agent's Puppet
script rather than stratos sh?

Thanks.

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by chris snow <ch...@gmail.com>.
Hi Akila,

The current stratos config.sh is failing for me on:

   ${RM} /mnt/apache-stratos-cartridge-agent-4.0.0-SNAPSHOT/wso2carbon.lck  [1]

The error is that the file doesn't exist.

Is this why you have introduced the method wait_for_puppet?

Many thanks,

Chris

---
[1] https://github.com/apache/incubator-stratos/blob/master/tools/puppet3-agent/config.sh#L91

On Sat, Apr 19, 2014 at 12:25 PM, Akila Ravihansa Perera
<ra...@wso2.com> wrote:
> Hi Chris,
>
> On 19 Apr 2014 16:09, "chris snow" <ch...@gmail.com> wrote:
>>
>> Hi Akila,
>>
>> It's looking good. Some questions:
>>
>> 1) Should we add an error handling function before Line 22, so
>> commands like Line 36 (PUPPET=`which puppet`) will be handled properly
>> if puppet doesn't exist?
>>
>> error() {
>>   echo "Error in script around line $1"
>>   exit 1
>> }
>> trap 'error ${LINENO}' ERR
>
> Well, my bad. Actually this should come after puppetinstall script. At that
> point script has either installed puppet or exit with -1
>
> +1 for checking puppetinstall exit status.
>
>>
>> 2) Will Line 36 (PUPPET=`which puppet`) actually point to anything?
>> Puppet isn't installed until Line 167
>>
>> 3) Is it worth introducing a timeout at Line 66?  If puppet doesn't
>> become available, the script will hang forever.
>
> +1
> I added this to test for some certificate issues.
>
>>
>> 4) A '-y' (assume yes) option would be good, so Line 166 doesn't have
>> to prompt for a user response
>
> +1. Will add this as well.
>
>>
>> Many thanks,
>>
>> Chris
>>
>> On Sat, Apr 19, 2014 at 11:15 AM, Akila Ravihansa Perera
>> <ra...@wso2.com> wrote:
>> > Hi Chris,
>> >
>> > I've been working on this JIRA [1] to improve config and puppetinstall
>> > scripts so that they can be executed again if failed once.
>> > As a part of that I've also been working on taking arguments from config
>> > script. Pl have a look at my forked repo in [2]
>> >
>> > [1] - https://issues.apache.org/jira/browse/STRATOS-583
>> > [2] -
>> >
>> > https://github.com/ravihansa3000/incubator-stratos/blob/master/tools/puppet3-agent/config.sh
>> >
>> >
>> > Thanks.
>> >
>> >
>> > On Sat, Apr 19, 2014 at 12:28 AM, Udara Liyanage <ud...@wso2.com> wrote:
>> >>
>> >>
>> >> Sorry I mixed up with the setup file. My bad.
>> >>
>> >>
>> >> Touched, not typed. Erroneous words are a feature, not a typo.
>> >
>> >
>> >
>> >
>> > --
>> > Akila Ravihansa Perera
>> > Software Engineer
>> > WSO2 Inc.
>> > http://wso2.com
>> >
>> > Phone: +94 77 64 154 38
>> > Blog: http://ravihansa3000.blogspot.com
>>
>>
>>
>> --
>> Check out my professional profile and connect with me on LinkedIn.
>> http://lnkd.in/cw5k69



-- 
Check out my professional profile and connect with me on LinkedIn.
http://lnkd.in/cw5k69

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by Akila Ravihansa Perera <ra...@wso2.com>.
Hi Chris,

On 19 Apr 2014 16:09, "chris snow" <ch...@gmail.com> wrote:
>
> Hi Akila,
>
> It's looking good. Some questions:
>
> 1) Should we add an error handling function before Line 22, so
> commands like Line 36 (PUPPET=`which puppet`) will be handled properly
> if puppet doesn't exist?
>
> error() {
>   echo "Error in script around line $1"
>   exit 1
> }
> trap 'error ${LINENO}' ERR

Well, my bad. Actually this should come after puppetinstall script. At that
point script has either installed puppet or exit with -1

+1 for checking puppetinstall exit status.

>
> 2) Will Line 36 (PUPPET=`which puppet`) actually point to anything?
> Puppet isn't installed until Line 167
>
> 3) Is it worth introducing a timeout at Line 66?  If puppet doesn't
> become available, the script will hang forever.

+1
I added this to test for some certificate issues.

>
> 4) A '-y' (assume yes) option would be good, so Line 166 doesn't have
> to prompt for a user response

+1. Will add this as well.

>
> Many thanks,
>
> Chris
>
> On Sat, Apr 19, 2014 at 11:15 AM, Akila Ravihansa Perera
> <ra...@wso2.com> wrote:
> > Hi Chris,
> >
> > I've been working on this JIRA [1] to improve config and puppetinstall
> > scripts so that they can be executed again if failed once.
> > As a part of that I've also been working on taking arguments from config
> > script. Pl have a look at my forked repo in [2]
> >
> > [1] - https://issues.apache.org/jira/browse/STRATOS-583
> > [2] -
> >
https://github.com/ravihansa3000/incubator-stratos/blob/master/tools/puppet3-agent/config.sh
> >
> >
> > Thanks.
> >
> >
> > On Sat, Apr 19, 2014 at 12:28 AM, Udara Liyanage <ud...@wso2.com> wrote:
> >>
> >>
> >> Sorry I mixed up with the setup file. My bad.
> >>
> >>
> >> Touched, not typed. Erroneous words are a feature, not a typo.
> >
> >
> >
> >
> > --
> > Akila Ravihansa Perera
> > Software Engineer
> > WSO2 Inc.
> > http://wso2.com
> >
> > Phone: +94 77 64 154 38
> > Blog: http://ravihansa3000.blogspot.com
>
>
>
> --
> Check out my professional profile and connect with me on LinkedIn.
> http://lnkd.in/cw5k69

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by chris snow <ch...@gmail.com>.
Hi Akila,

It's looking good. Some questions:

1) Should we add an error handling function before Line 22, so
commands like Line 36 (PUPPET=`which puppet`) will be handled properly
if puppet doesn't exist?

error() {
  echo "Error in script around line $1"
  exit 1
}
trap 'error ${LINENO}' ERR

2) Will Line 36 (PUPPET=`which puppet`) actually point to anything?
Puppet isn't installed until Line 167

3) Is it worth introducing a timeout at Line 66?  If puppet doesn't
become available, the script will hang forever.

4) A '-y' (assume yes) option would be good, so Line 166 doesn't have
to prompt for a user response

Many thanks,

Chris

On Sat, Apr 19, 2014 at 11:15 AM, Akila Ravihansa Perera
<ra...@wso2.com> wrote:
> Hi Chris,
>
> I've been working on this JIRA [1] to improve config and puppetinstall
> scripts so that they can be executed again if failed once.
> As a part of that I've also been working on taking arguments from config
> script. Pl have a look at my forked repo in [2]
>
> [1] - https://issues.apache.org/jira/browse/STRATOS-583
> [2] -
> https://github.com/ravihansa3000/incubator-stratos/blob/master/tools/puppet3-agent/config.sh
>
>
> Thanks.
>
>
> On Sat, Apr 19, 2014 at 12:28 AM, Udara Liyanage <ud...@wso2.com> wrote:
>>
>>
>> Sorry I mixed up with the setup file. My bad.
>>
>>
>> Touched, not typed. Erroneous words are a feature, not a typo.
>
>
>
>
> --
> Akila Ravihansa Perera
> Software Engineer
> WSO2 Inc.
> http://wso2.com
>
> Phone: +94 77 64 154 38
> Blog: http://ravihansa3000.blogspot.com



-- 
Check out my professional profile and connect with me on LinkedIn.
http://lnkd.in/cw5k69

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by Akila Ravihansa Perera <ra...@wso2.com>.
Hi Chris,

I've been working on this JIRA [1] to improve config and puppetinstall
scripts so that they can be executed again if failed once.
As a part of that I've also been working on taking arguments from config
script. Pl have a look at my forked repo in [2]

[1] - https://issues.apache.org/jira/browse/STRATOS-583
[2] -
https://github.com/ravihansa3000/incubator-stratos/blob/master/tools/puppet3-agent/config.sh


Thanks.


On Sat, Apr 19, 2014 at 12:28 AM, Udara Liyanage <ud...@wso2.com> wrote:

>
> Sorry I mixed up with the setup file. My bad.
>
>
> Touched, not typed. Erroneous words are a feature, not a typo.
>



-- 
Akila Ravihansa Perera
Software Engineer
WSO2 Inc.
http://wso2.com

Phone: +94 77 64 154 38
Blog: http://ravihansa3000.blogspot.com

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by Udara Liyanage <ud...@wso2.com>.
Sorry I mixed up with the setup file. My bad.


Touched, not typed. Erroneous words are a feature, not a typo.

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by chris snow <ch...@gmail.com>.
Hi Udara,

config.sh will only require 3 parameters as far as I can tell:

--service-name
--puppet-master-ip
--puppet-master-hostname


On Fri, Apr 18, 2014 at 7:51 PM, Udara Liyanage <ud...@wso2.com> wrote:
>
> +1
> However there will be huge number of parameters I guess.
>
>
> Touched, not typed. Erroneous words are a feature, not a typo.



-- 
Check out my professional profile and connect with me on LinkedIn.
http://lnkd.in/cw5k69

Re: '/tools/puppet3-agent/config.sh' - make capable of being called from another script?

Posted by Udara Liyanage <ud...@wso2.com>.
+1
However there will be huge number of parameters I guess.


Touched, not typed. Erroneous words are a feature, not a typo.