Hi Alvaro,

Thanks for the input. I am doing exactly this. 

My original question in my OP is this:

I can execute this 'sed' command with success if I run it directly in a 
bash shell. However it fails to take effect if I specify the same action in 
the shell provider in my vagrant file.

What can cause the shell provider to fail to execute the 'sed' command? 

Cheers, Tony

On Friday, 7 November 2014 08:47:21 UTC+11, Alvaro Miranda Aguilera wrote:
>
> Hello.
>
> There is a separation of Vagrant, and what you do with Vagrant.
>
> in this case Vagrant is running your script fine, but is not giving you 
> the expected result.
>
> That questions is more suitable for ubuntu mailing list, however I will 
> reply here.
>
> you have to modify us.archive and archive
>
> simple approach:
>
>         sed -i -e 's/us.archive.ubuntu.com/old-releases.ubuntu.com/g' 
> /etc/apt/sources.list
> sed -i -e 's/us.security.ubuntu.com/old-releases.ubuntu.com/g' 
> /etc/apt/sources.list
> sed -i -e 's/archive.ubuntu.com/old-releases.ubuntu.com/g' 
> /etc/apt/sources.list
> sed -i -e 's/security.ubuntu.com/old-releases.ubuntu.com/g' 
> /etc/apt/sources.list
>
> This fix the apt part.. i did a vagrant up, but chef complained.. 
>
> I will suggest get a working machine or build your own one..
>
> happy to assist on that..
>
> Alvaro.
>
> On Fri, Nov 7, 2014 at 12:42 AM, Anthony Kong <[email protected] 
> <javascript:>> wrote:
>
>> What do you mean by this?  Which line you are referring to?
>>
>> I basically just added a line to the vagrant file (see the link I 
>> provided in OP)
>>
>> from
>>
>> $install_chef = <<SCRIPT
>> if ! [ -d "/opt/chef" ];
>> then
>>     apt-get update
>>     apt-get install -y curl
>>     curl -L https://www.opscode.com/chef/install.sh | bash
>> fi
>> SCRIPT
>>
>> to this:
>>
>> $install_chef = <<SCRIPT
>> if ! [ -d "/opt/chef" ];
>> then
>>     sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.
>> ubuntu.com/g' /etc/apt/sources.list
>>     apt-get update
>>     apt-get install -y curl
>>     curl -L https://www.opscode.com/chef/install.sh | bash
>> fi
>> SCRIPT
>>
>>
>>
>> On Thursday, 6 November 2014 18:02:59 UTC+11, Alvaro Miranda Aguilera 
>> wrote:
>>>
>>> without seeing the line i can't comment.
>>>
>>> On Thu, Nov 6, 2014 at 4:19 PM, Anthony Kong <[email protected]> 
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am trying to vagrant up this vagrant file: https://github.com/
>>>> sensu/sensu-chef/blob/master/examples/Vagrantfile
>>>>
>>>> Because the distribution is old, when the apt-get update is run, it 
>>>> throws a lot of error messages like
>>>>
>>>> ==> default: Err http://us.archive.ubuntu.com raring/main Sources
>>>> ==> default:   404  Not Found [IP: 91.189.91.23 80]
>>>>
>>>> A solution is to update the */etc/apt/sources.list* to point to 
>>>> old-releases before running* apt-get*
>>>>
>>>> Here is the command: 
>>>>
>>>> sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.
>>>> ubuntu.com/g' /etc/apt/sources.list
>>>>
>>>> However for some reason the shell provisioner did not modify the file. 
>>>>
>>>> If I *vagrant ssh *into the box and run it manually, the sed command 
>>>> works.
>>>>
>>>> Why it is the case?
>>>>
>>>>
>>>> Thanks, Tony
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Vagrant" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Vagrant" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to