【问题标题】:how to provide username and password for chef windows_zipfile recipe如何为厨师 windows_zipfile 食谱提供用户名和密码
【发布时间】:2021-03-09 14:02:56
【问题描述】:

我正在尝试使用来自 Chef Supermarket windows cookbookwindows_zipfile 资源,但我使用的源 URL 需要具有用户权限才能获取任何工件。

我们如何将用户名和密码添加到windows_zipfile 资源?

windows_zipfile 'c:\test_app' do
  source 'https://artifactory/repoName/ApplicationName/zipfile.zip'
  action :unzip
end

【问题讨论】:

  • source 是 URL 吗?您的问题中提到的那个看起来不像需要特权的东西。
  • @seshadri_c 更新源

标签: authentication chef-infra chef-windows


【解决方案1】:

windows_zipfile 自定义资源没有任何属性来接受 URL 的凭据。 更重要的是整个食谱已被弃用,取而代之的是原生 archive_file 资源。

注意:此资源已被弃用,因为 Chef Infra Client 15.0 附带了一个新的 archive_file 资源,该资源本机处理多种存档格式。请更新任何使用此资源的食谱,改为使用 archive_file 资源。

我建议通过提供凭据使用remote_file resource 下载文件。然后您可以使用archive_file(如果 Chef 版本 > 15)或windows_zipfile 从本地路径中提取文件。

remote_file 'C:\test_app.zip' do
  source 'https://artifactory/repoName/ApplicationName/zipfile.zip'
  remote_user 'user'
  remote_password 'secret'
end

# showing example for 'archive_file'
archive_file 'C:\test_app' do
  source 'C:\test_app.zip'
  action :extract
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-17
    • 2018-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多