Using remote_file resource within Chef 12 for pulling remote files from shared location to client side

Hi guys,

Can you please provide me with the example on how to use headers attribute
within remote_file Chef recipe?

Here what I have and it doesn’t seem to work:

remote_file “c:\test_chef.txt” do
source "file:////prodstore/Shares/Engineering/test_chef.txt"
headers({“Cookies” => “user=kasjdhfak; pass=sdkjhf” })
end

What I basically need is to make chef-client (windows platform) to pull data
from Windows shared repository. In order to not save all data on Chef server.

Issue I met is that windows shared repo uses authentication and I need ability
to provide user/pass for getting anything from that source.

If you happene to know how to pull files using Chef resources from Amazon S3
storage as well it would be nice if you vould share that knowledge as well.

Thank you a lot in advance.
Much appreciated.

Regards,
Taras.

On Monday, December 15, 2014 at 11:40 AM, klum_tz@ukr.net wrote:

Hi guys,

Can you please provide me with the example on how to use headers attribute
within remote_file Chef recipe?

Here what I have and it doesn't seem to work:

remote_file "c:\test_chef.txt" do
source "file:////prodstore/Shares/Engineering/test_chef.txt"
headers({"Cookies" => "user=kasjdhfak; pass=sdkjhf" })
end

Looks like it should be Cookie (with no ’s’). HTTP cookie - Wikipedia

The java cookbook temporarily used remote_file the way you are trying to (they reverted the change to be compatible with older chef versions, but AFAIK the code worked). You can look at their example here: https://github.com/agileorbit-cookbooks/java/blob/bc583dce88de391c1c749b7b74c7fda84aeeedf2/providers/ark.rb#L67-L71

What I basically need is to make chef-client (windows platform) to pull data
from Windows shared repository. In order to not save all data on Chef server.

Issue I met is that windows shared repo uses authentication and I need ability
to provide user/pass for getting anything from that source.
The logs on your server should be helpful for debugging, too.

Thank you a lot in advance.
Much appreciated.

Regards,
Taras.

--
Daniel DeLeo

Taras,

Here an example working with Chef 12:

header = "blablabla"
current = "https://s3.amazonaws.com/package.rpm"

http_request "get_package" do
headers({"Referer" => "#{header}"})
url "#{current}"
end

On Mon, Dec 15, 2014 at 5:40 PM, klum_tz@ukr.net wrote:

Hi guys,

Can you please provide me with the example on how to use headers attribute
within remote_file Chef recipe?

Here what I have and it doesn't seem to work:

remote_file "c:\test_chef.txt" do
source "file:////prodstore/Shares/Engineering/test_chef.txt"
headers({"Cookies" => "user=kasjdhfak; pass=sdkjhf" })
end

What I basically need is to make chef-client (windows platform) to pull
data
from Windows shared repository. In order to not save all data on Chef
server.

Issue I met is that windows shared repo uses authentication and I need
ability
to provide user/pass for getting anything from that source.

If you happene to know how to pull files using Chef resources from Amazon
S3
storage as well it would be nice if you vould share that knowledge as well.

Thank you a lot in advance.
Much appreciated.

Regards,
Taras.

--
-- Tiago Cruz

Thanks Tiago,
But the subject of the biggest interest is “bla bla” within header. How and in what manner to set up password and user name if http response will need it.
By the way, http_request you mentioned… Can it be used in order to save data on client side instead of just running package? The main goal is to download something fro either S3 or remote location and put into some exact place within windows client. Like to c:\ drive some folder. I have not found like destinatin path on client side for downloaded package.
Thank you a lot in advance for your replies and efforts in assisting me in this question.
Regards, Taras.
— Оригінальне повідомлення —
Від кого: “Tiago Cruz” tiago.tuxkiller@gmail.com
Дата: 15 грудня 2014, 22:56:26

Taras,
Here an example working with Chef 12:
header = “blablabla” current = " https://s3.amazonaws.com/package.rpm "
http_request “get_package” do headers({“Referer” => “#{header}”}) url “#{current}” end

On Mon, Dec 15, 2014 at 5:40 PM, < klum_tz@ukr.net > wrote:
Hi guys,

Can you please provide me with the example on how to use headers attribute
within remote_file Chef recipe?

Here what I have and it doesn’t seem to work:

remote_file “c:\test_chef.txt” do
source "file:////prodstore/Shares/Engineering/test_chef.txt"
headers({“Cookies” => “user=kasjdhfak; pass=sdkjhf” })
end

What I basically need is to make chef-client (windows platform) to pull data
from Windows shared repository. In order to not save all data on Chef server.

Issue I met is that windows shared repo uses authentication and I need ability
to provide user/pass for getting anything from that source.

If you happene to know how to pull files using Chef resources from Amazon S3
storage as well it would be nice if you vould share that knowledge as well.

Thank you a lot in advance.
Much appreciated.

Regards,
Taras.


– Tiago Cruz

There's a few different s3_file resources that all solve the problem of
pulling down auth'd s3 files:

On Mon Dec 15 13:26:55 2014, klum_tz@ukr.net wrote:

Thanks Tiago,

But the subject of the biggest interest is "bla bla" within header.
How and in what manner to set up password and user name if http
response will need it.

By the way, http_request you mentioned... Can it be used in order to
save data on client side instead of just running package?
The main goal is to download something fro either S3 or remote
location and put into some exact place within windows client.
Like to c:\ drive some folder. I have not found like destinatin path
on client side for downloaded package.

Thank you a lot in advance for your replies and efforts in assisting
me in this question.

Regards,
Taras.

--- Оригінальне повідомлення ---
Від кого: "Tiago Cruz" <tiago.t uxkiller@gmail.com>
Дата: 15 грудня 2014, 22:56:26

Taras,

Here an example working with Chef 12:

    header = "blablabla"
    current = "https://s3.amazonaws.com/package.rpm"

    http_request "get_package" do
      headers({"Referer" => "#{header}"})
      url "#{current}"
    end



On Mon, Dec 15, 2014 at 5:40 PM, <klum_tz@ukr.net
<mailto:klum_tz@ukr.net>> wrote:


    Hi guys,

    Can you please provide me with the example on how to use
    headers attribute
    within remote_file Chef recipe?

    Here what I have and it doesn't seem to work:

    remote_file "c:\test_chef.txt" do
    source "file:////prodstore/Shares/Engineering/test_chef.txt"
    headers({"Cookies" => "user=kasjdhfak; pass=sdkjhf" })
    end

    What I basically need is to make chef-client (windows
    platform) to pull data
    from Windows shared repository. In order to not save all data
    on Chef server.

    Issue I met is that windows shared repo uses authentication
    and I need ability
    to provide user/pass for getting anything from that source.

    If you happene to know how to pull files using Chef resources
    from Amazon S3
    storage as well it would be nice if you vould share that
    knowledge as well.

    Thank you a lot in advance.
    Much appreciated.

    Regards,
    Taras.



--
-- Tiago Cruz