Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-24 Thread Craig Rodrigues
On Tue, Jan 13, 2015 at 4:14 PM, Allan Jude  wrote:

> On 2015-01-13 18:11, Craig Rodrigues wrote:
> > Hi,
> >
> > Ahmed Kamal, a devops expert, is helping me to script the steps to
> > upgrade a cluster of FreeBSD machines.  For certain machines,
> > we want to track the official FreeBSD releases and use freebsd-update
> > to install official updates.
> >
> > We found that when the invocation of freebsd-update was scripted
> > and not run via a real tty, we can into this error:
> >
> > "freebsd-update fetch should not be run non-interactively."
> >
> > There are various workarounds mentioned on various web pages.
> > However, should we modify freebsd-update so that it can work better
> > when not run via a real tty?  This would make it more devops/automation
> > friendly.
> >
> > The closest thing I have found is "freebsd-update cron", which can fetch
> > the updates and run without a real tty.  The only problem with
> > "freebsd-update cron"
> > is that it sleeps a random amount of time between 1 and 3600 seconds
> before
> > fetching the updates.  This is OK when run in a cron job,
> > but not OK when run as part of a devops automation framework.
> >
> > Anybody have ideas as to the best way to proceed in fixing this in
> > freebsd-update?
> > --
> > Craig
> > ___
> > freebsd-current@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "
> freebsd-current-unsubscr...@freebsd.org"
> >
>
> I think this requirement was originally added when Colin hosted the
> mirrors for FreeBSD update himself, and was worried about everyone
> scripting it to run via crontab at midnight every night.
>
> It is likely a false requirement, and can be safely removed.
>
> Dealing with the merges, only really affects version upgrades, and is
> less of an issue compared to being able to automate security fixes.
>


Hi,

I submitted this review: https://reviews.freebsd.org/D1665
to remove the check for an interactive tty in "freebsd-update fetch".

Being able to run "freebsd-update fetch" via automation will make it much
more
convenient to update clusters of FreeBSD nodes.

--
Craig
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread Allan Jude
On 2015-01-13 18:11, Craig Rodrigues wrote:
> Hi,
> 
> Ahmed Kamal, a devops expert, is helping me to script the steps to
> upgrade a cluster of FreeBSD machines.  For certain machines,
> we want to track the official FreeBSD releases and use freebsd-update
> to install official updates.
> 
> We found that when the invocation of freebsd-update was scripted
> and not run via a real tty, we can into this error:
> 
> "freebsd-update fetch should not be run non-interactively."
> 
> There are various workarounds mentioned on various web pages.
> However, should we modify freebsd-update so that it can work better
> when not run via a real tty?  This would make it more devops/automation
> friendly.
> 
> The closest thing I have found is "freebsd-update cron", which can fetch
> the updates and run without a real tty.  The only problem with
> "freebsd-update cron"
> is that it sleeps a random amount of time between 1 and 3600 seconds before
> fetching the updates.  This is OK when run in a cron job,
> but not OK when run as part of a devops automation framework.
> 
> Anybody have ideas as to the best way to proceed in fixing this in
> freebsd-update?
> --
> Craig
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
> 

I think this requirement was originally added when Colin hosted the
mirrors for FreeBSD update himself, and was worried about everyone
scripting it to run via crontab at midnight every night.

It is likely a false requirement, and can be safely removed.

Dealing with the merges, only really affects version upgrades, and is
less of an issue compared to being able to automate security fixes.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread NGie Cooper
On Tue, Jan 13, 2015 at 4:09 PM, NGie Cooper  wrote:
> On Tue, Jan 13, 2015 at 3:29 PM, Bryan Drewery  wrote:
>> On 1/13/2015 5:11 PM, Craig Rodrigues wrote:
>>> Hi,
>>>
>>> Ahmed Kamal, a devops expert, is helping me to script the steps to
>>> upgrade a cluster of FreeBSD machines.  For certain machines,
>>> we want to track the official FreeBSD releases and use freebsd-update
>>> to install official updates.
>>>
>>> We found that when the invocation of freebsd-update was scripted
>>> and not run via a real tty, we can into this error:
>>>
>>> "freebsd-update fetch should not be run non-interactively."
>>>
>>> There are various workarounds mentioned on various web pages.
>>> However, should we modify freebsd-update so that it can work better
>>> when not run via a real tty?  This would make it more devops/automation
>>> friendly.
>>>
>>> The closest thing I have found is "freebsd-update cron", which can fetch
>>> the updates and run without a real tty.  The only problem with
>>> "freebsd-update cron"
>>> is that it sleeps a random amount of time between 1 and 3600 seconds before
>>> fetching the updates.  This is OK when run in a cron job,
>>> but not OK when run as part of a devops automation framework.
>>>
>>> Anybody have ideas as to the best way to proceed in fixing this in
>>> freebsd-update?
>>> --
>>> Craig
>>
>>
>> sed -i '' -e 's,-t 0 ];,-t 0 ] \&\& [ 0 -eq 1 ],' /usr/sbin/freebsd-update
>>
>> This is untested. We'll likely put it in Poudriere as well.
>
> freebsd-update needs to grow a non-interactive option probably:
>
> 2375 read dummy  2376 ${EDITOR} `pwd`/merge/new/${F} < /dev/tty
> 2377 done < failed.merges
> 2378 rm failed.merges

$ grep -nr /dev/tty `which freebsd-update`
2375:read dummy http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread NGie Cooper
On Tue, Jan 13, 2015 at 3:29 PM, Bryan Drewery  wrote:
> On 1/13/2015 5:11 PM, Craig Rodrigues wrote:
>> Hi,
>>
>> Ahmed Kamal, a devops expert, is helping me to script the steps to
>> upgrade a cluster of FreeBSD machines.  For certain machines,
>> we want to track the official FreeBSD releases and use freebsd-update
>> to install official updates.
>>
>> We found that when the invocation of freebsd-update was scripted
>> and not run via a real tty, we can into this error:
>>
>> "freebsd-update fetch should not be run non-interactively."
>>
>> There are various workarounds mentioned on various web pages.
>> However, should we modify freebsd-update so that it can work better
>> when not run via a real tty?  This would make it more devops/automation
>> friendly.
>>
>> The closest thing I have found is "freebsd-update cron", which can fetch
>> the updates and run without a real tty.  The only problem with
>> "freebsd-update cron"
>> is that it sleeps a random amount of time between 1 and 3600 seconds before
>> fetching the updates.  This is OK when run in a cron job,
>> but not OK when run as part of a devops automation framework.
>>
>> Anybody have ideas as to the best way to proceed in fixing this in
>> freebsd-update?
>> --
>> Craig
>
>
> sed -i '' -e 's,-t 0 ];,-t 0 ] \&\& [ 0 -eq 1 ],' /usr/sbin/freebsd-update
>
> This is untested. We'll likely put it in Poudriere as well.

freebsd-update needs to grow a non-interactive option probably:

2375 read dummy http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread Baptiste Daroussin
On Tue, Jan 13, 2015 at 05:29:16PM -0600, Bryan Drewery wrote:
> On 1/13/2015 5:11 PM, Craig Rodrigues wrote:
> > Hi,
> > 
> > Ahmed Kamal, a devops expert, is helping me to script the steps to
> > upgrade a cluster of FreeBSD machines.  For certain machines,
> > we want to track the official FreeBSD releases and use freebsd-update
> > to install official updates.
> > 
> > We found that when the invocation of freebsd-update was scripted
> > and not run via a real tty, we can into this error:
> > 
> > "freebsd-update fetch should not be run non-interactively."
> > 
> > There are various workarounds mentioned on various web pages.
> > However, should we modify freebsd-update so that it can work better
> > when not run via a real tty?  This would make it more devops/automation
> > friendly.
> > 
> > The closest thing I have found is "freebsd-update cron", which can fetch
> > the updates and run without a real tty.  The only problem with
> > "freebsd-update cron"
> > is that it sleeps a random amount of time between 1 and 3600 seconds before
> > fetching the updates.  This is OK when run in a cron job,
> > but not OK when run as part of a devops automation framework.
> > 
> > Anybody have ideas as to the best way to proceed in fixing this in
> > freebsd-update?
> > --
> > Craig
> 
> 
> sed -i '' -e 's,-t 0 ];,-t 0 ] \&\& [ 0 -eq 1 ],' /usr/sbin/freebsd-update
> 
> This is untested. We'll likely put it in Poudriere as well.
> 
> IMHO the check should be removed in the official version.
> 
You do not need it in poudriere as the rexec binary emulates a tty to workaround
this.

Best regards,
Bapt


pgpTkV4xcLG1l.pgp
Description: PGP signature


Re: Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread Bryan Drewery
On 1/13/2015 5:11 PM, Craig Rodrigues wrote:
> Hi,
> 
> Ahmed Kamal, a devops expert, is helping me to script the steps to
> upgrade a cluster of FreeBSD machines.  For certain machines,
> we want to track the official FreeBSD releases and use freebsd-update
> to install official updates.
> 
> We found that when the invocation of freebsd-update was scripted
> and not run via a real tty, we can into this error:
> 
> "freebsd-update fetch should not be run non-interactively."
> 
> There are various workarounds mentioned on various web pages.
> However, should we modify freebsd-update so that it can work better
> when not run via a real tty?  This would make it more devops/automation
> friendly.
> 
> The closest thing I have found is "freebsd-update cron", which can fetch
> the updates and run without a real tty.  The only problem with
> "freebsd-update cron"
> is that it sleeps a random amount of time between 1 and 3600 seconds before
> fetching the updates.  This is OK when run in a cron job,
> but not OK when run as part of a devops automation framework.
> 
> Anybody have ideas as to the best way to proceed in fixing this in
> freebsd-update?
> --
> Craig


sed -i '' -e 's,-t 0 ];,-t 0 ] \&\& [ 0 -eq 1 ],' /usr/sbin/freebsd-update

This is untested. We'll likely put it in Poudriere as well.

IMHO the check should be removed in the official version.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Devops question: freebsd-update needs a real tty to run, problem for automation

2015-01-13 Thread Craig Rodrigues
Hi,

Ahmed Kamal, a devops expert, is helping me to script the steps to
upgrade a cluster of FreeBSD machines.  For certain machines,
we want to track the official FreeBSD releases and use freebsd-update
to install official updates.

We found that when the invocation of freebsd-update was scripted
and not run via a real tty, we can into this error:

"freebsd-update fetch should not be run non-interactively."

There are various workarounds mentioned on various web pages.
However, should we modify freebsd-update so that it can work better
when not run via a real tty?  This would make it more devops/automation
friendly.

The closest thing I have found is "freebsd-update cron", which can fetch
the updates and run without a real tty.  The only problem with
"freebsd-update cron"
is that it sleeps a random amount of time between 1 and 3600 seconds before
fetching the updates.  This is OK when run in a cron job,
but not OK when run as part of a devops automation framework.

Anybody have ideas as to the best way to proceed in fixing this in
freebsd-update?
--
Craig
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"