Giter Site home page Giter Site logo

sous-chefs / ark Goto Github PK

View Code? Open in Web Editor NEW
98.0 40.0 182.0 723 KB

Development repository for the ark cookbook

Home Page: https://supermarket.chef.io/cookbooks/ark

License: Apache License 2.0

Ruby 99.95% HTML 0.05%
chef ark hacktoberfest chef-cookbook chef-resource managed-by-terraform

ark's Introduction

ark cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Overview

This cookbook provides ark, a resource for managing software archives. It manages the fetch-unpack-configure-build-install process common to installing software from source, or from binary distributions that are not fully fledged OS packages.

This cookbook started its life as a modified version of Infochimp's install_from cookbook. It has since been heavily refactored and extended to meet different use cases.

Given a simple project archive available at a url:

ark 'pig' do
  url 'http://apache.org/pig/pig-0.8.0.tar.gz'
end

The ark resource will:

  • fetch it to to /var/cache/chef/
  • unpack it to the default path (/usr/local/pig-0.8.0)
  • create a symlink for :home_dir (/usr/local/pig) pointing to path
  • add specified binary commands to the environment PATH variable

By default, the ark will not run again if the :path is not empty. Ark provides many actions to accommodate different use cases, such as :dump, :cherry_pick, :put, and :install_with_make.

For remote files ark supports URLs using the remote_file resource. Local files are accessed with the file:// syntax.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Oracle
  • Fedora
  • FreeBSD
  • SmartOS
  • macOS
  • openSUSE / SUSE Linux Enterprises
  • Windows

Should work on common Unix/Linux systems with typical userland utilities like tar, gzip, etc. May require the installation of build tools for compiling from source, but that installation is outside the scope of this cookbook.

Chef

  • Chef 15.3+

Cookbooks

  • seven_zip

Attributes

Customize the attributes to suit site specific conventions and defaults.

  • node['ark']['apache_mirror'] - if the URL is an apache mirror, use the attribute as the default. default: http://apache.mirrors.tds.net
  • node['ark']['prefix_root'] - default base location if the prefix_root is not passed into the resource. default: /usr/local
  • node['ark']['prefix_bin'] - default binary location if the prefix_bin is not passed into the resource. default: /usr/local/bin
  • node['ark']['prefix_home'] - default home location if the prefix_home is not passed into the resource. default: /usr/local
  • node['ark']['package_dependencies'] - prerequisite system packages that need to be installed to support ark. default: varies based on platform
  • node['ark']['tar'] - allows overriding the default path to the tar binary, which varies based on platform
  • node['ark']['sevenzip_binary'] - allows overriding the default path to the 7zip binary, which is determined based on registry key value

Resources

  • ark - does the extract/build/configure

Actions

  • :install: extracts the file and creates a 'friendly' symbolic link to the extracted directory path
  • :configure: configure ahead of the install action
  • :install_with_make: extracts the archive to a path, runs configure, make, and make install.
  • :dump: strips all directories from the archive and dumps the contained files into a specified path
  • :cherry_pick: extract a specified file from an archive and places in specified path
  • :put: extract the archive to a specified path, does not create any symbolic links
  • :remove: removes the extracted directory and related symlink #TODO
  • :setup_py: runs the command "python setup.py" in the extracted directory
  • :setup_py_build: runs the command "python setup.py build" in the extracted directory
  • :setup_py_install: runs the command "python setup.py install" in the extracted directory

Action: cherry_pick

Extract a specified file from an archive and places in specified path.

Parameters for cherry_pick

  • path: directory to place file in.
  • creates: specific file to cherry-pick.

Action: dump

Strips all directories from the archive and dumps the contained files into a specified path.

NOTE: This currently only works for zip archives

Parameters for :dump

  • path: path to dump files to.

  • mode: file mode for app_home, as an integer.

    • Example: 0775
  • creates: if you are appending files to a given directory, ark needs a condition to test whether the file has already been extracted. You can specify with creates, a file whose existence indicates the ark has previously been extracted and does not need to be extracted again.

Action: put

Extract the archive to a specified path, does not create any symbolic links.

Parameters for :put

  • path: path to extract to.

    • Default: /usr/local
  • append_env_path: boolean, if true, append the ./bin directory of the extracted directory to the global PATH variable for all users.

Attribute Parameters

  • name: name of the package, defaults to the resource name.

  • url: url for tarball, .tar.gz, .bin (oracle-specific), .war, and .zip currently supported. Also supports special syntax

  • :name:version:apache_mirror: that will auto-magically construct download url from the apache mirrors site.

  • version: software version, defaults to 1.

  • mode: file mode for app_home, is an integer.

  • prefix_root: default prefix_root, for use with :install* actions.

  • prefix_home: default directory prefix for a friendly symlink to the path.

    • Example: /usr/local/maven -> /usr/local/maven-2.2.1
  • prefix_bin: default directory to place a symlink to a binary command.

    • Example: /opt/bin/mvn -> /opt/maven-2.2.1/bin/mvn, where the prefix_bin is /opt/bin
  • path: path to extract the ark to. The :install* actions overwrite any user-provided values for :path.

    • Default: /usr/local/<name>-<version> for the :install, :install_with_make actions
  • home_dir: symbolic link to the path :prefix_root/:name-:version, does not apply to :dump, :put, or :cherry_pick actions.

    • Default: :prefix_root/:name
  • has_binaries: array of binary commands to symlink into /usr/local/bin/, you must specify the relative path.

    • Example: [ 'bin/java', 'bin/javaws' ]
  • append_env_path: boolean, similar to has_binaries but less granular. If true, append the ./bin directory of the extracted directory to. the PATH environment variable for all users, by placing a file in /etc/profile.d/. The commands are symbolically linked into /usr/bin/*. This option provides more granularity than the boolean option.

    • Example: mvn, java, javac, etc.
  • environment: hash of environment variables to pass to invoked shell commands like tar, unzip, configure, and make.

  • strip_components: number of components in path to strip when extracting archive. With default value of 1, ark strips the leading directory from an archive, which is the default for both unzip and tar commands.

  • autoconf_opts: an array of command line options for use with the GNU autoconf script.

    • Example: [ '--include=/opt/local/include', '--force' ]
  • make_opts: an array of command line options for use with make.

    • Example: [ '--warn-undefined-variables', '--load-average=2' ]
  • owner: owner of extracted directory.

    • Default: root
  • group: group of extracted directory.

    • Default: root
  • backup: The number of backups to be kept in /var/chef/backup (for UNIX- and Linux-based platforms) or C:/chef/backup (for the Microsoft Windows platform). Set to false to prevent backups from being kept.

    • Default: 5

Examples

This example copies ivy.tar.gz to /var/cache/chef/ivy-2.2.0.tar.gz, unpacks its contents to /usr/local/ivy-2.2.0/ -- stripping the leading directory, and symlinks /usr/local/ivy to /usr/local/ivy-2.2.0

 # install Apache Ivy dependency resolution tool
 ark "ivy" do
   url 'http://someurl.example.com/ivy.tar.gz'
   version '2.2.0'
   checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   action :install
 end

This example copies jdk-7u2-linux-x64.tar.gz to /var/cache/chef/jdk-7.2.tar.gz, unpacks its contents to /usr/local/jvm/jdk-7.2/ -- stripping the leading directory, symlinks /usr/local/jvm/default to /usr/local/jvm/jdk-7.2, and adds /usr/local/jvm/jdk-7.2/bin/ to the global PATH for all users. The user 'foobar' is the owner of the /usr/local/jvm/jdk-7.2 directory:

 ark 'jdk' do
   url 'http://download.example.com/jdk-7u2-linux-x64.tar.gz'
   version '7.2'
   path "/usr/local/jvm/"
   home_dir "/usr/local/jvm/default"
   checksum  '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   append_env_path true
   owner 'foobar'
 end

Install Apache Ivy dependency resolution tool in /resource_name in this case /usr/local/ivy, do not symlink, and strip any leading directory if one exists in the tarball:

 ark "ivy" do
    url 'http://someurl.example.com/ivy.tar.gz'
    checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
    action :put
 end

Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any leading directory if one exists, don't keep backup copies of ivy.tar.gz:

 ark "ivy" do
   path "/home/foobar"
   url 'http://someurl.example.com/ivy.tar.gz'
   checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   action :put
   backup false
 end

Strip all directories and dump files into path specified by the path attribute. You must specify the creates attribute in order to keep the extraction from running every time. The directory path will be created if it doesn't already exist:

 ark "my_jars" do
   url  "http://example.com/bunch_of_jars.zip"
   path "/usr/local/tomcat/lib"
   creates "mysql.jar"
   owner "tomcat"
   action :dump
 end

Extract specific files from a tarball (currently only handles one named file):

 ark 'mysql-connector-java' do
   url 'http://oracle.com/mysql-connector.zip'
   creates 'mysql-connector-java-5.0.8-bin.jar'
   path '/usr/local/tomcat/lib'
   action :cherry_pick
 end

Build and install haproxy and use alternative values for prefix_root, prefix_home, and prefix_bin:

 ark "haproxy" do
   url  "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
   version "1.5"
   checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
   make_opts [ 'TARGET=linux26' ]
   prefix_root '/opt'
   prefix_home '/opt'
   prefix_bin  '/opt/bin'
   action :install_with_make
 end

You can also supply the file extension in case the file extension can not be determined by the URL:

 ark "test_autogen" do
   url 'https://github.com/zeromq/libzmq/tarball/master'
   extension "tar.gz"
   action :install_with_make
 end

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

ark's People

Contributors

a-chernykh avatar brodock avatar bryanwb avatar buri17 avatar cwebberops avatar damacus avatar detjensrobert avatar dwmarshall avatar guilhem avatar iennae avatar jarosser06 avatar jblaine avatar josephholsten avatar juanje avatar kbuchsicf avatar kitchen-porter avatar legal90 avatar mrobbins avatar nukemberg avatar patcon avatar potto007 avatar ramereth avatar renovate[bot] avatar samdunne avatar sethvargo avatar sgtcoolguy avatar superflav avatar tas50 avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ark's Issues

Fix test kitchen travis tests

Hey! I'm guessing the cookbook was transferred over to you and no credentials were set up after the switch? Any chance we could get those going again and make sure the cookbook stays healthy? (Digital Ocean is $5/month the cheapest server running constantly, but since we only spin up when running tests, this should be much much less :)

Requiring OtherCookbooks

I am trying to run this cookbook but when i try to upload it says that I require 3 other cookbooks called "build-essential", "7-zip", and "windows". The platform for those are windows, but the virtual machine I am using is running ubuntu, Windows keeps failing when I try to run that. How do I solve this?

:put action on zip files not extracting files

ark 'myblog' do
    url 'https://example.com/files/myblog.zip'
    path '/var/www/'
    checksum '333bfd8b6a513ed68c5189138182a11222443c843922cf318d57fa7f0f5a9b4e'
    owner 'www-data'
    group 'www-data'
    action :put
end

The above code should be downloading an archive of "myblog".zip and extracting its contents to /var/www/myblog. The issue I am experiencing is that all the contents of the zip file are not actually being extracted. Only the directories from the zip file are being placed in /var/www/myblog

Checksum Regex validation Error

The current regex validator for checksum attribute of the ark expects the checksum to be exactly 64 characters attribute :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil , but ideally thats not the case in the realworld, there are cases where checksum is less than 64 characters as well.

"creates" doesn't work for :dump action

In one of my recipes I remove a version-specific directory before using ark to :dump to that directory. However, when using :dump, this recipe does not work twice in a row even though the destination is empty each time ark is called. I figured this was because I was not using the "creates" attribute, so I tried that out. It seemed to have no effect. I dug a little deeper and noticed that the creates attribute is actually never used in the :dump action section of the provider. If this is not a bug, I apologize - can you point me in the direction that I can flush previous unpack directories and unpack every time?

ark resource/provider warning: strip_leading_dir attribute is deprecated

I am using the terraform cookbook, which has a dependency on the ark cookbook. Use of the ark resource displays this warning message on a chef run:

ark 1.0.0 was used.

ark[terraform] action install[2016-02-10T17:08:27-08:00] WARN: DEPRECATED: strip_leading_dir attribute was deprecated. Use strip_components instead.

Opsworks on Chef 11.10

Hi,

an SSD is mounted at /usr/local

ark kept on failing to install and link packages, e.g. as used by elasticsearch to install and link elasticsearch, My guess is custom recipes, which use ark, run before opsworks can have a chance to finish setting up the necessary directory structure, in this case /usr/local/bin.

When I start the box without any custom recipe and allow it to setup fully, then run custom recipe, which use ark, then custom recipe completes successfully. Not sure if there's any event that opsworks publishes where ark can wait upon for opsworks to finish setup directory structures before ark does its thing.

Thoughts? Any one experience similar behavior? What's your workaround, other than what I mentioned above? Is this the wrong place to ask/discuss?

Unzipping WAR File

When i try to unzip the war files using the ark, I see the the permissions are not set recursively the the folders inside the WAR.

The code snippet that I used to unzip is as follows,

ark "ROOT" do
  name "ROOT"
  url "http://localhost/abcd.war"
  path "/opt/local/tomcat-7.0.42/webapps"
  owner "mickey"
  group "mouse"
  strip_components 0
  action :put
end

When the extract happens the ROOT folder is set with proper permissions with right owner and group, but the sub directories under that are not set with right permissions, this is causing the application kind of not started correctly.

'put' action does not extract all files from package.

On Ubuntu 14.04 LTS running the following recipe:

ark 'fpdi' do                                                       
  url 'http://www.setasign.com/supra/kon2_dl/80506/FPDI-1.5.2.tgz'  
  path '/usr/share/php'                                             
  version '1.5.2'                                                   
  action 'put'                                                      
end

Results in the following files extracted:

root@vagrant:/var/www/html/jenkins# ls -la /usr/share/php/fpdi/   
total 24                                                          
drwxr-xr-x 2 root root 4096 Aug 20 14:09 .                        
drwxr-xr-x 5 root root 4096 Aug 20 14:09 ..                       
-rwxr-xr-x 1 root root 3063 Jun 26 10:09 FilterASCII85.php        
-rwxr-xr-x 1 root root 1498 Jun 26 10:09 FilterASCIIHexDecode.php 
-rwxr-xr-x 1 root root 4596 Jun 26 10:09 FilterLZW.php            

But the contents of the package are:

root@vagrant:/var/www/html/jenkins# tar tvf /var/chef/cache/fpdi.tgz               
-rwxr-xr-x Unknown/Unknown 3063 2014-06-26 10:09 filters/FilterASCII85.php         
-rwxr-xr-x Unknown/Unknown 4596 2014-06-26 10:09 filters/FilterLZW.php             
-rwxr-xr-x Unknown/Unknown 1498 2014-06-26 10:09 filters/FilterASCIIHexDecode.php  
-rwxr-xr-x Unknown/Unknown 3661 2014-06-26 10:09 pdf_context.php                   
-rwxr-xr-x Unknown/Unknown 6738 2014-06-26 10:09 fpdi_bridge.php                   
-rwxr-xr-x Unknown/Unknown 17535 2014-06-26 10:09 fpdf_tpl.php                     
-rwxr-xr-x Unknown/Unknown 22565 2014-06-26 10:09 fpdi.php                         
-rwxr-xr-x Unknown/Unknown 27512 2014-06-26 10:09 pdf_parser.php                   
-rwxr-xr-x Unknown/Unknown  9718 2014-06-26 10:09 fpdi_pdf_parser.php              

ark version: 0.9.0
chef version: 11.14.6

Release v0.9.1 to remove minitests

The commit 6a38298 removes old minitest files in files/default

Can you do a release with v0.9.1 so that it doesn't cause windows boxes (via test kitchen at least) to puke?

You should probably add all of files/default to chefignore since they all seem to be tests, anyway.

Thanks!

Integration Test Failure: CentOS

Test failure related to the tar flag "J" not being supported.

Command

The whole test suite rake integration:vagrant is failing and I don't yet know how to pick that apart so I started to work with some bare commands I ran the following:

kitchen create default-centos-510
kitchen converge default-centos-510

Error

I, [2014-06-12T13:22:55.087192 #98722]  INFO -- default-centos-510: ---- Begin output of /bin/tar xJf /tmp/kitchen/cache/foo_txz-3.txz --strip-components=1 ----
I, [2014-06-12T13:22:55.087212 #98722]  INFO -- default-centos-510: STDOUT: 
I, [2014-06-12T13:22:55.087227 #98722]  INFO -- default-centos-510: STDERR: /bin/tar: invalid option -- J
I, [2014-06-12T13:22:55.087240 #98722]  INFO -- default-centos-510: Try `tar --help' or `tar --usage' for more information.
I, [2014-06-12T13:22:55.087254 #98722]  INFO -- default-centos-510: ---- End output of /bin/tar xJf /tmp/kitchen/cache/foo_txz-3.txz --strip-components=1 ----
I, [2014-06-12T13:22:55.087295 #98722]  INFO -- default-centos-510: Ran /bin/tar xJf /tmp/kitchen/cache/foo_txz-3.txz --strip-components=1 returned 64
I, [2014-06-12T13:22:55.191689 #98722]  INFO -- default-centos-510: [2014-06-12T20:22:54+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
E, [2014-06-12T13:22:55.301805 #98722] ERROR -- default-centos-510: Converge failed on instance <default-centos-510>.
E, [2014-06-12T13:22:55.301910 #98722] ERROR -- default-centos-510: ------Exception-------
E, [2014-06-12T13:22:55.301930 #98722] ERROR -- default-centos-510: Class: Kitchen::ActionFailed
E, [2014-06-12T13:22:55.301943 #98722] ERROR -- default-centos-510: Message: SSH exited (1) for command: [sudo -E chef-client -z --config /tmp/kitchen/client.rb --log_level info --json-attributes /tmp/kitchen/dna.json]
E, [2014-06-12T13:22:55.301955 #98722] ERROR -- default-centos-510: ---Nested Exception---
E, [2014-06-12T13:22:55.301966 #98722] ERROR -- default-centos-510: Class: Kitchen::SSHFailed
E, [2014-06-12T13:22:55.301976 #98722] ERROR -- default-centos-510: Message: SSH exited (1) for command: [sudo -E chef-client -z --config /tmp/kitchen/client.rb --log_level info --json-attributes /tmp/kitchen/dna.json]
E, [2014-06-12T13:22:55.301987 #98722] ERROR -- default-centos-510: ------Backtrace-------
E, [2014-06-12T13:22:55.301996 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:112:in `rescue in run_remote'
E, [2014-06-12T13:22:55.302007 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:108:in `run_remote'
E, [2014-06-12T13:22:55.302040 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:48:in `block in converge'
E, [2014-06-12T13:22:55.302051 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/ssh.rb:47:in `initialize'
E, [2014-06-12T13:22:55.302061 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:43:in `new'
E, [2014-06-12T13:22:55.302071 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:43:in `converge'
E, [2014-06-12T13:22:55.302081 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/kitchen-vagrant-0.15.0/lib/kitchen/driver/vagrant.rb:75:in `converge'
E, [2014-06-12T13:22:55.302091 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `public_send'
E, [2014-06-12T13:22:55.302101 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `block in perform_action'
E, [2014-06-12T13:22:55.302110 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:308:in `call'
E, [2014-06-12T13:22:55.302120 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:308:in `synchronize_or_call'
E, [2014-06-12T13:22:55.302138 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:283:in `block in action'
E, [2014-06-12T13:22:55.302150 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
E, [2014-06-12T13:22:55.302160 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:282:in `action'
E, [2014-06-12T13:22:55.302170 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `perform_action'
E, [2014-06-12T13:22:55.302180 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:256:in `converge_action'
E, [2014-06-12T13:22:55.302190 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:246:in `block in transition_to'
E, [2014-06-12T13:22:55.302200 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:245:in `each'
E, [2014-06-12T13:22:55.302210 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:245:in `transition_to'
E, [2014-06-12T13:22:55.302235 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:119:in `converge'
E, [2014-06-12T13:22:55.302246 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:109:in `public_send'
E, [2014-06-12T13:22:55.302255 #98722] ERROR -- default-centos-510: /Users/franklinwebber/.rvm/gems/ruby-2.1.2/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:109:in `block (2 levels) in run_action'
E, [2014-06-12T13:22:55.302265 #98722] ERROR -- default-centos-510: ----------------------

Theory

Looking up I see that "TXZ" is a slackware archive format or at least that is what the article is saying its predominate use.

The issue is with the tar flag "J". Which it does not seem to have on CentOS. As someone not familiar with many of the tar flags I don't know when that was removed or if it is only not present on this platform.

CentOS 510 - FAILURE

I found that tar does NOT support the "J" flag.
I found that I CANNOT extract the contents of the example txz archive.

tar --version reports 1.15.1.

$ kitchen login default-centos-510
$ cd /tmp/kitchen/cookbooks/ark/files/default
$ tar xf foo.txz

CentOS 65 - FAILURE

I found that tar does support the "J" flag.
I found that I CANNOT extract the contents of the example txz archive without the "J" flag.
I found that I CANNOT extract the contents of the example txz archive WITH the "J" flag.
I found that I can extract the contents of the example txz archive WITH the "J" flag if I install xz-lzma-compat.

tar --version reports 1.23.

$ kitchen login default-centos-65
$ cd /tmp/kitchen/cookbooks/ark/files/default
$ tar xf foo.txz
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
$ tar Jxf foo.txz
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
$ sudo yum install xz-lzma-compat
$ tar Jxf foo.txz

Fedora 19 - SUCCESS

I found that tar does support the "J" flag.
I found that I can extract the contents of the example txz archive without the "J" flag.

tar --version reports 1.26.

$ kitchen login default-fedora-19
$ cd /tmp/kitchen/cookbooks/ark/files/default
$ tar xf foo.txz

Ubuntu 1004 - SUCCESS

tar --version reports 1.22.

I found that tar does support the "J" flag.
I found that I CANNOT extract the contents of the example txz archive without the "J" flag.

$ kitchen login default-ubuntu-1004
$ cd /tmp/kitchen/cookbooks/ark/files/default
$ tar xf foo.txz
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
$ tar Jxf foo.txz

Results

CentOS 510 cannot process txz archives unless we are able to deliver a higher tar (Need higher than 1.22) version to the platform. A failure with the appropriate message seems like the most unfortunate and straightforward move.

CentOS 65 needs 'xz-lzma-compat' installed.

Using an LWRP provider by its name (Ark) directly is no longer supported in Chef 12

Hi there -- I am seeing this warning, and I can't actually tell if it's me or the ark cookbook causing it:

Using an LWRP provider by its name (Ark) directly is no longer supported in Chef 12 and will be removed.  Use Chef::ProviderResolver.new(node, resource, action) instead. at 1 location:
           - /tmp/kitchen/cache/cookbooks/ark/resources/default.rb:26:in `initialize'

I'm simply using the recipe DSL to make a resource and call run_action(...) on it.

Use `:put` action in similar way to `:install` action?

I initially used the default action :install and had the resource creating both the versioned and symlinked directory: /usr/share/tomcat-8.0.24 symlinked to /usr/share/tomcat. What I hoped to do with :put is to create only /usr/share/tomcat-8.0.24. I've run into trouble though and I'm not able to get this to work. Is there any easy way to use :put and achieve this? It seems that when using this action lots of the passed in attributes are doctored.

Any tips? Thank you.

Fix README.MD please

I faced to misleading descriptions in readme:

Actions
....
:install_with_make: extracts the archive to a path, runs make, and make install. It does not run the configure step at this time

In fact I see that this action is doing configure as well nowadays

ark "test_autogen" do
url 'https://github.com/zeromq/libzmq/tarball/master'
extension "tar.gz"
action [ :configure, :install_with_make ]
end

Based on the example above and definition of install_with_make I configured my recipe to execute ark with :configure and :Install_with_make and that failed. It failed because the second action install_with_make was terminated after the step of 2nd time downloading the artifact, thus next steps like make and make install were skipped.

Allow deleting target directory before extraction

When a new version of an archive is extracted, the directory where the previous version is currently installed is not deleted first. Consequently, if some files or directories do not exist anymore in the new archive version, they are still present in the target directory after extraction.Thus, the content of the target directory could not strictly reflect the content of the updated archive.

This issue could be solved by supporting a new boolean attribute (at cookbook level or resource level). When enabled, this attribute would trigger the deletion of the target directory before to perform the extraction.

new_resource.path not getting set on windows platform

I am new to chef and trying to use ark to install JMeter on a windows VM node. I created a cookbook called my_jmeter_install. I added below windows specific attribute to my_jmeter_install.rb –

normal['ark']['win_install_dir'] = 'C:\Users\Administrators\JMeter'

In metadata.rb of my_jmeter_install cookbook, I added - depends "ark"
In default.rb of my_jmeter_install cookbook, I added -
include_recipe "ark"
ark 'my_jmeter' do
url 'http://mirror.cogentco.com/pub/apache//jmeter/binaries/apache-jmeter-2.13.zip'
version '2.13'
action :install
end

When I converge the node, I get the following error –

Error executing action install on resource 'ark[my_jmeter]'

ArgumentError


You must supply a name when declaring a directory resource

After turning on debug option for chef-client, I can see the 'new_resource.path' is not set in ark/libraries/default.rb –
if node['platform_family'] === 'windows'
new_resource.path = new_resource.win_install_dir

Any ideas what could be causing ‘new_resource.path’ not to be set? It is blank in the debug output.

getting 403 error when bootstrapping with this cookbook

This is on Ubuntu 14.04

Recipe: maven::default
  * ark[maven] action install
    * directory[/usr/local/maven-3.1.1] action create
      - create new directory /usr/local/maven-3.1.1
    * remote_file[/var/chef/cache/maven-3.1.1.tar.gz] action create
      - create new file /var/chef/cache/maven-3.1.1.tar.gz
      - update content in file /var/chef/cache/maven-3.1.1.tar.gz from none to 077ed4
      (new content is binary, diff output suppressed)
    * execute[unpack /var/chef/cache/maven-3.1.1.tar.gz] action nothing (skipped due to action :nothing)
    * execute[set owner on /usr/local/maven-3.1.1] action nothing (skipped due to action :nothing)
    * link[/usr/local/maven] action create
      - create symlink at /usr/local/maven to /usr/local/maven-3.1.1
    * template[/etc/profile.d/maven.sh] action create

      ================================================================================
      Error executing action `create` on resource 'template[/etc/profile.d/maven.sh]'
      ================================================================================

      Net::HTTPServerException
      ------------------------
      403 "Forbidden"

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/ark/providers/default.rb

       85:     template "/etc/profile.d/#{new_resource.name}.sh" do
       86:       cookbook 'ark'
       87:       source 'add_to_path.sh.erb'
       88:       owner 'root'
       89:       group 'root'
       90:       mode '0755'
       91:       cookbook 'ark'
       92:       variables(:directory => "#{new_resource.path}/bin")
       93:       only_if { new_resource.append_env_path }
       94:     end
       95:   end

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/ark/providers/default.rb:85:in `block in class_from_file'

      template("/etc/profile.d/maven.sh") do
        provider Chef::Provider::Template
        action "create"
        retries 0
        retry_delay 2
        guard_interpreter :default
        path "/etc/profile.d/maven.sh"
        backup 5
        atomic_update true
        source "add_to_path.sh.erb"
        cookbook "ark"
        variables {:directory=>"/usr/local/maven-3.1.1/bin"}
        cookbook_name "maven"
        mode "0755"
        owner "root"
        group "root"
        only_if { #code block }
      end

    * execute[unpack /var/chef/cache/maven-3.1.1.tar.gz] action run
      - execute /bin/tar xzf /var/chef/cache/maven-3.1.1.tar.gz --strip-components=1
    * execute[set owner on /usr/local/maven-3.1.1] action run
      - execute chown -R root:0 /usr/local/maven-3.1.1

    ================================================================================
    Error executing action `install` on resource 'ark[maven]'
    ================================================================================

    Net::HTTPServerException
    ------------------------
    template[/etc/profile.d/maven.sh] (/var/chef/cache/cookbooks/ark/providers/default.rb line 85) had an error: Net::HTTPServerException: 403 "Forbidden"

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/maven/recipes/default.rb

     28: ark 'maven' do
     29:   url             node['maven'][mvn_version]['url']
     30:   checksum        node['maven'][mvn_version]['checksum']
     31:   home_dir        node['maven']['m2_home']
     32:   win_install_dir node['maven']['m2_home']
     33:   version         node['maven'][mvn_version]['version']
     34:   append_env_path true
     35: end
     36:

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/maven/recipes/default.rb:28:in `from_file'

    ark("maven") do
      provider Chef::Provider::Ark
      action :install
      updated true
      updated_by_last_action true
      retries 0
      retry_delay 2
      guard_interpreter :default
      cookbook_name "maven"
      recipe_name "default"
      url "http://apache.mirrors.tds.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz"
      checksum "077ed466455991d5abb4748a1d022e2d2a54dc4d557c723ecbacdc857c61d51b"
      home_dir "/usr/local/maven"
      win_install_dir "/usr/local/maven"
      version "3.1.1"
      append_env_path true
      extension "tar.gz"
      prefix_bin "/usr/local/bin"
      path "/usr/local/maven-3.1.1"
      release_file "/var/chef/cache/maven-3.1.1.tar.gz"
      strip_components 1
      owner "root"
      group 0
    end

Recipe: postfix::_common
  * service[postfix] action restart
    - restart service service[postfix]
Recipe: postfix::transports
  * execute[update-postfix-transport] action run
    - execute postmap /etc/postfix/transport
Recipe: openssh::default
  * service[ssh] action restart
    - restart service service[ssh]
Recipe: chef-client::init_service
  * service[chef-client] action restart
    - restart service service[chef-client]

Running handlers:
[2015-05-22T10:59:24+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-05-22T10:59:24+00:00] ERROR: Exception handlers complete
[2015-05-22T10:59:24+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 182 resources updated in 4813.32478806 seconds
[2015-05-22T10:59:26+00:00] ERROR: ark[maven] (maven::default line 28) had an error: Net::HTTPServerException: template[/etc/profile.d/maven.sh] (/var/chef/cache/cookbooks/ark/providers/default.rb line 85) had an error: Net::HTTPServerException: 403 "Forbidden"
[2015-05-22T10:59:28+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

unzip_with_strip_components should not rely on bash/ksh specific handling of */

Hi,

I am currently facing some weird issue with ark on Solaris 10.

       ---- Begin output of unzip -q -u -o /tmp/kitchen/cache/splunkforwarder.zip -d /tmp/d20140626-583-18zyngk && rsync -a /tmp/d20140626-583-18zyngk/*/ /cm/splunkforwarder && rm -rf /tmp/d20140626-583-18zyngk ----
       STDOUT:
       STDERR: rsync: change_dir "/tmp/d20140626-583-18zyngk/*" failed: No such file or directory (2)

Looking at debug output of my chef run showing this ark parameters

       ark("splunkforwarder") do
         provider Chef::Provider::Ark
         action [:put]
         updated true
         updated_by_last_action true
         retries 0
         retry_delay 2
         guard_interpreter :default
         cookbook_name "my_monitoring"
         recipe_name "splunkforwarder"
         url "http://path/to/splunkforwarder.zip"
         version "5.0.2-149561"
         extension "zip"
         owner "vagrant"
         group "vagrant"
         path "/cm/splunkforwarder"
         release_file "/tmp/kitchen/cache/splunkforwarder.zip"
         strip_components 1
       end

The issue happens only on Solaris 10, not on Solaris 11 and not on CentOS 6 based machines.

The Zip archive looks like this (so there is really some directory to strip away)

-bash-3.2$ unzip -l splunkforwarder.zip  | less
Archive:  splunkforwarder.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-01-2013 14:54   splunkforwarder/
      509  02-01-2013 13:57   splunkforwarder/README-splunk.txt
        0  02-01-2013 14:54   splunkforwarder/bin/
    45920  02-01-2013 14:36   splunkforwarder/bin/bloom
    45920  02-01-2013 14:36   splunkforwarder/bin/btool       
...

Rsync is version 3.0.8 protocol version 30 on both Solaris 10 and Solaris 11.

When I invoke the command line chef is complaining about

unzip -q -u -o /tmp/kitchen/cache/splunkforwarder.zip -d /tmp/d20140626-583-18zyngk && rsync -a /tmp/d20140626-583-18zyngk/*/ /cm/splunkforwarder && rm -rf /tmp/d20140626-583-18zyngk

manually on Solaris 10 then it works OK.

I also looked at different Bash versions (3.2 on Solaris 10, 4 on Solaris 11), installed bash 4 on Solaris 10 and still no difference.

Any idea what could be the reason appriciated.

Action :put fails if *.zip contains files instead of directory with files

Case 1:

  archive.zip:
    |-- file1
    |-- file2
STDERR: rsync: change_dir "/tmp/d20140813-26874-g56l7y/*" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
---- End output of unzip -q -u -o /var/chef/cache/archive.zip -d /tmp/d20140813-26874-g56l7y&& rsync -a /tmp/d20140813-26874-g56l7y/*/ /mnt/archive&& rm -rf  /tmp/d20140813-26874-g56
l7y ----
Ran unzip -q -u -o /var/chef/cache/archive.zip -d /tmp/d20140813-26874-g56l7y&& rsync -a /tmp/d20140813-26874-g56l7y/*/ /mnt/archive&& rm -rf  /tmp/d20140813-26874-g56l7y returned 23
[2014-08-13T15:36:04+00:00] ERROR: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
[2014-08-13T15:36:04+00:00] ERROR: Sleeping for 300 seconds before trying again

Case 2:

archive.zip:
  |--dir  
    |-- file1
    |-- file2

No error

Using custom matchers

This is probably an issue of me not understanding how to use custom matchers, but if I were to use and depend on this cookbook in my wrapper cookbook, should I not be able to use the custom matchers you've defined in ark/libraries/matchers.rb? I found I needed to use something like this:

https://github.com/lynx44/chefspec_extensions

Support for remote mounts

Some of our distributives are not available via http and must be obtained by mounting a cifs or nfs share. It would be great if this cookbook supported multiple file retrieval protocols.

Alternatively, separating the decompression stage out of the ark LWRP would make sense as well, either as a standalone library function or LWRP.

Setting home_dir attribute does not work

Setting the home_dir attribute does not result in a symlink being created at the specified path as is documented in https://github.com/burtlo/ark#attribute-parameters . Rather, the symlink is created at the default, which is :prefix_root/:name.

Digging in, I found that the only place that home_dir is set is at:

https://github.com/burtlo/ark/blob/master/libraries/default.rb#L50

which in turn calls the home_dir method at:

https://github.com/burtlo/ark/blob/master/libraries/resource_defaults.rb#L15

that derives its value from prefix_home and not from home_dir:

def home_dir
  prefix_home = resource.prefix_home || prefix_home_from_node_in_run_context
  ::File.join(prefix_home, resource.name)
end

Fix for this is to either: a) rewrite the documentation, explaining how the symlink is really created, or b) fix the resource_defaults.home_dir method so that it makes use of the home_dir attribute. If you'd like to go with 'b', I have a patch I can submit that will tweak the code along the lines of this (I still need to test it out):

def home_dir
  if resource.home_dir.nil? || resource.home_dir.empty?
    prefix_home = resource.prefix_home || prefix_home_from_node_in_run_context
    ::File.join(prefix_home, resource.name)
  else
    resource.home_dir
  end
end

Getting error "NoMethodError: undefined method `new' for Ark:Module" with Chef 12

Chef 12.0.0 was officially released on Dec 5 (https://www.chef.io/blog/2014/12/05/release-chef-client-12-0-0/), and soon after this announcement our Test Kitchen code that didn't specify a version with the require_chef_omnibus attribute began blowing up on Ark with ERRORs that stated

...had an error: NoMethodError: undefined method `new' for Ark:Module

Digging further we were able to find that the problem was in the provider_for_action method in Chef's lib/chef/resource.rb.

Prior to Chef 12.0.0 release candidate, this method was declared more or less like this (taken from https://www.omniref.com/ruby/gems/chef/11.12.4/symbols/Chef::Resource/provider_for_action#line=673)

def provider_for_action(action)
  # leverage new platform => short_name => resource
  # which requires explicitly setting provider in
  # resource class
  if self.provider
    provider = self.provider.new(self, self.run_context)
    provider.action = action
    provider
  else # fall back to old provider resolution
    Chef::Platform.provider_for_resource(self, action)
  end
end

But as of 12.0.0.rc0, this method is now declared like this (taken from https://www.omniref.com/ruby/gems/chef/12.0.0.rc.0/symbols/Chef::Resource/provider_for_action#line=685)

def provider_for_action(action)
  provider = run_context.provider_resolver.resolve(self, action).new(self, run_context)
  provider.action = action
  provider
end

The code is obviously failing on .new(selv, run_context) from the line that includes run_context.provider_resolver.resolve(self, action).new(self, run_context), and there's no new method in the Ark module, so that would seem to be it.

To recreate

Create a new cookbook using berkshelf

$ berks cookbook ark_with_chef_12

In the new cookbook, make recipes/default.rb as

ark 'tomcat_7' do
  url 'http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.32/bin/apache-tomcat-7.0.32.tar.gz'
  checksum 'c26ae0bc424e2639f5c77eb4d274a026c5a584a404dbdbb247ab6d2c3ebe8258'
  version '7'
  path  '/usr/local/tomcat'
  home_dir '/usr/local/tomcat/default'
  owner 'root'
end

In the new cookbook, make .kitchen.yml as


---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04

suites:
  - name: default
    run_list:
      - recipe[ark_with_chef_12::default]
    attributes:

Run a kitchen setup

$ kitchen setup

Watch it blow up with

[2014-12-08T22:09:09+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 1.091858713 seconds
[2014-12-08T22:09:09+00:00] ERROR: ark[tomcat_7] (ark_with_chef_12::default line 20) had an error: NoMethodError: undefined method `new' for Ark:Module
[2014-12-08T22:09:09+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-ubuntu-1204>.
>>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
>>>>>> ----------------------

Tries to package install `make` on FreeBSD which does not exist.

Just tried testing a cookbook of mine which depends on ark and it fails with:

[2014-08-04T13:49:49+00:00] ERROR: freebsd_package[make] (ark::default line 22) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '69'
       ---- Begin output of pkg rquery '%v' make ----
       STDOUT: 
       STDERR: 
       ---- End output of pkg rquery '%v' make ----
       Ran pkg rquery '%v' make returned 69
       [2014-08-04T13:49:49+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

This seems to be because ark wants to install make as a dependency, however FreeBSD already comes with a version of make installed but the package manager (pkgng) cannot see it as being installed as it is in the base OS. There is no package named make to install from the repos (there is gmake) and therefore ark fails.

ark :put fails on Windows when there are spaces in path

The path should be quoted when calling icacls to set the owner.

With such resource declaration

ark 'packages' do
  path "C:\path with spaces"
  url tar_url
  extension 'tar'
  strip_components 0
  owner 'SYSTEM'
  action :put
end

we get the following error:

---- Begin output of icacls C:\path with spaces/packages\* /setowner SYSTEM ----
STDOUT: 
STDERR: Invalid parameter "with"
---- End output of icacls C:\path with spaces/packages\* /setowner SYSTEM ----
Ran icacls C:\path with spaces/packages\* /setowner SYSTEM returned 87

invalid number of parameters for xcopy on windows

For example when deploying maven on windows 8.1 with the maven cookbook on chef 12:
The package is extracted normaly in the Temp dir, and then I get:

Invalid number of parameters
---- End output of "C:\7-zip\7z.exe" e "C:\chef\cache/maven-3.1.1.tar.gz" -so | "C:\7-zip\7z.exe" x -aoa -si -ttar -o"C:/Users/traiman/AppData/Local/Temp/d20150325-43224-gdk0ta" -uy && for /f %1 in ('dir /ad /b "C:\Users\traiman\AppData\Local\Temp\d20150325-43224-gdk0ta"') do xcopy "C:\Users\traiman\AppData\Local\Temp\d20150325-43224-gdk0ta%1" "/usr/local/maven" /s /e ----
Ran "C:\7-zip\7z.exe" e "C:\chef\cache/maven-3.1.1.tar.gz" -so | "C:\7-zip\7z.exe" x -aoa -si -ttar -o"C:/Users/traiman/AppData/Local/Temp/d20150325-43224-gdk0ta" -uy && for /f %1 in ('dir /ad /b "C:\Users\traiman\AppData\Local\Temp\d20150325-43224-gdk0ta"') do xcopy "C:\Users\traiman\AppData\Local\Temp\d20150325-43224-gdk0ta%1" "/usr/local/maven" /s /e returned 4

rspec failures

Among others:

  1) ark install installs
     Failure/Error: expect(resource).to notify('execute[unpack /var/chef/cache/test_install-2.tar.gz]').to(:run)
       expected "directory[/usr/local/test_install-2]" to notify "execute[unpack /var/chef/cache/test_install-2.tar.gz]" with action :run, but did not.

       Other notifications were:

           "directory[/usr/local/test_install-2]" notifies "execute[unpack /var/folders/jb/3mjvb9r133v0hzqfyn20yz34000zj7/T/d20151028-53172-ul6izb/test_install-2.tar.gz]" to :run, :delayed

     # ./spec/resources/default_spec.rb:19:in `block (3 levels) in <top (required)>'

These lines in spec/resources/default_spec.rb are intended to correct that:

  before(:each) do
    Chef::Config[:file_cache_path] = "/var/chef/cache"
  end

but my Chef-fu is not strong enough to know how to fix that.

Allow setting the 'backup' parameter on the remote_file resource

We are using ark to download and ':put' a large file. The remote_file resource defaults to keeping five backups of the file. This is causing some disk capacity problems.

Please allow setting a 'backup' parameter on the ark resource that will get passed to the remote_file resource. This should be the simplest way to constrain the amount of storage used by ark resources.

Dump-support for .gz, bz2 and .xz files

It seems that ark is not able to simply download & extract .gz files (simply gzipped files, no tar.gz archives). Same for .bz2 and .xz

failing example:

ark 'GeoIP' do
  url 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz'
  path '/tmp/GeoIP.dat'
  action :dump
end

Couldn't test ark notifications using ChefSpec

According to official ChefSpec example, to test if resource notifies other resource there should be resource_name method. In case of ark following code should work:

describe "foo::bar" do
  let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }

  it "notifies other resource" do
    expect(chef_run.ark("package")).to notify("execute[command]").to(:run)
  end
end

But it throws exception:

undefined method `ark' for #<ChefSpec::SoloRunner:0x00000008a66640>

I'm not sure why, could we fix this somehow?

Chef 12 deprecation in LWRP

I don't know if this has been reported yet but my Chef run gave me this warning that I wanted to pass on.

Deprecated features used!
         Using an LWRP provider by its name (Ark) directly is no longer supported in Chef 12 and will be removed.  Use Chef::ProviderResolver.new(node, resource, action) instead. at 1 location:
           - /tmp/kitchen/cache/cookbooks/ark/resources/default.rb:26:in `initialize'

Let me know if it's something on my side. Thanks.

Ark doesn't handle failed Chef run correctly

While trying to fix #93 I discovered that ark can leave a server in an unconfigured state if Chef halts during convergence. Here is the abbreviated code for the "dump" provider that shows why:

  remote_file new_resource.release_file do
    ...
    notifies :run, "execute[unpack #{new_resource.release_file}]"
  end

  execute "unpack #{new_resource.release_file}" do
    ...
    notifies :run, "execute[set owner on #{new_resource.path}]"
    action :nothing
  end

  execute "set owner on #{new_resource.path}" do
    ...
    action :nothing
  end

If the Chef run halts immediately after remote_file then the next time Chef runs it will detect that the file is already downloaded and skip the execute and set owner steps.

Also, in the event a bad sysop manually sets the file owner then the owner won't get reset during the Chef run as it should.

So I guess the underlying question is why use action :nothing and notify the next resource in the chain instead of simply using action :<default> for each action?

ark on windows runs 7z e instead of x

Hello,
I think there is a bug in the cookbook but it might be me misunderstanding the concept.
I was thinking that action :put would simply extract the zip in a folder, however, it runs 7z.exe e which extracts files without folder.

Tried with action :dump as well but this also runs 7z e instead of x.
What action should I use to get my folders kept in my extracted directory on windows ?
Thanks

Let me supply a custom command to extract the fetched file

Google in its all-knowing wisdom has decreed that the latest version of the Android NDK shall be shipped as a 7zip self-extracting archive. So naturally ark errors with

Don't know how to expand http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin

I'd like to somehow let ark know that it should use 7z x #{file_path} in this case.

install_with_make skipping due to action nothing

I am trying to install ruby from source. The source files are extracting to the /usr/local/ruby-2.1.6 directory but the remaining steps are skipping due to action:nothing.

ark "ruby" do
   url 'ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz'
   version '2.1.6'
   action :install_with_make
end

Output

     Recipe: ark-test::default
          ark[ruby] action install_with_make
           * directory[/usr/local/ruby-2.1.6] action create (up to date)
           * remote_file[/tmp/kitchen/cache/ruby-2.1.6.tar.gz] action create (up to date)
           * execute[unpack /tmp/kitchen/cache/ruby-2.1.6.tar.gz] action nothing (skipped due to action :nothing)
           * execute[set owner on /usr/local/ruby-2.1.6] action nothing (skipped due to action :nothing)
           * execute[autogen /usr/local/ruby-2.1.6] action nothing (skipped due to action :nothing)
           * execute[configure /usr/local/ruby-2.1.6] action nothing (skipped due to action :nothing)
           * execute[make /usr/local/ruby-2.1.6] action nothing (skipped due to action :nothing)
           * execute[make install /usr/local/ruby-2.1.6] action nothing (skipped due to action :nothing)
            (up to date)

Please help me on this

Where are the providers for setup_py_build, setup_py_install and setup_py gone?

It's possible I am missing something as I'm still fairly new to chef. But here it is.

After upgrading from 0.1.0 to 0.9.0 (yes, I know quite the jump) I get errors like the following running chef-client: Cannot find a resource for action_setup_py_install ...

After looking at the ark source code for a while, I found that :setup_py_build, :setup_py_install, :setup_py are defined/declared in resources/default.rb as allowed_actions but I can't see their counter part definitions in providers/default.rb

I've tried adding my own setup_py_install definition in the latter and surely I don't get the error any more...

Am I missing something?

I guess in the mean time I'll copy over the old definition of that action locally for myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.