[chef] Re: torrent hash is same for every torrent after the first


Chronological Thread 
  • From: Chris McClimans < >
  • To:
  • Subject: [chef] Re: torrent hash is same for every torrent after the first
  • Date: Tue, 30 Aug 2011 08:22:18 +1200

**The short of it**

I'm forced to opscode transmission cookbook on local files as the
cookbook requires urls that end it .torrent. (Not that big of a deal,
but I'm unsure of a clean solution)
Every transmission_torrent_file[] after the first one, reports the
torrent hash of the first, keeping it from being loaded into
transmission.
I'm unsure how to debug or proceed.


**Possibly useful background**

The opscode transmission cookbook will only treat torrents as remote
files if the start with 'http' and end with '.torrent'.

https://github.com/opscode/cookbooks/blob/master/transmission/providers/torrent_file.rb#L97
:
* if(new_resource.torrent =~ /^(https?:\/\/)(.*\/)(.*\.torrent)$/)

The urls I have for the torrents I want to use don't follow that logic:
* ie 
http://driverpacks.net/driverpacks/windows/xp/x86/chipset/11.08/download/torrent

However the driverpack urls do have the filename in the
Content-Disposition header.
http://en.wikipedia.org/wiki/MIME#Content-Disposition

To help decide the local target filename I decided parse the body/blob
of the torrent file to give us the name of the file that will result
from running the torrent:
* resp.body.bdecode["info"]["name"]

So I wrote a script to generate the the default attributes:
http://ix.io/1Rl

Which results in a somewhat readable dictionary.

https://github.com/passionengine/ii/blob/master/site-cookbooks/unattended/attributes/default.rb#L40

That looks something like this:
default[:unattended][:driverpack][:torrents] = [
  
{:url=>"http://driverpacks.net/driverpacks/windows/xp/x86/bluetooth/9.10/download/torrent";,
  :sha256=>"1bc4d487fae0c0b963e8f5a98778fe5ebd07ce403d0b6bc48f748a8363e0caaf",
  :content_filename=>"DP_Bluetooth_wnt5_x86-32_910.7z",
  :torrent_filename=>"DP_Bluetooth_wnt5_x86-32_910.torrent"},
 
{:url=>"http://driverpacks.net/driverpacks/windows/xp/x86/chipset/11.08/download/torrent";,
  :sha256=>"fcbcd23b21b29b36db2e5e7899b40757a3b40a006e3f837c6e7678a6477dc432",
  :content_filename=>"DP_Chipset_wnt5_x86-32_1108.7z",
  :torrent_filename=>"DP_Chipset_wnt5_x86-32_1108.torrent"}]

I updated the recipe to utilize the new array:

https://github.com/passionengine/ii/blob/master/site-cookbooks/unattended/recipes/default.rb#L139


**Now onto the meat of the matter:**


I have debug logs of the relevant parts my chef run:
http://ix.io/1Rm

However when I do my chef-client run, the first torrent works fine:

DEBUG: Caching a copy of torrent file
/var/cache/chef/unattended/torrents/DP_Bluetooth_wnt5_x86-32_910.torrent
at /var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent
INFO: Processing
file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)
DEBUG: /var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent is about
to be hashed!
DEBUG: Caching a copy of torrent file
/var/cache/chef/unattended/torrents/DP_Bluetooth_wnt5_x86-32_910.torrent
at /var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent
DEBUG: Setting file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent]
to the state of the prior
file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent]
INFO: Processing
file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)
DEBUG: 
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Bluetooth_wnt5_x86-32_910.7z]
torrent hash = 4551e4bcfcd85ec04e0c28d5a151a0c1829fec19
DEBUG: Caching a copy of torrent file
/var/cache/chef/unattended/torrents/DP_Bluetooth_wnt5_x86-32_910.torrent
at /var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent
DEBUG: Setting file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent]
to the state of the prior
file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent]
INFO: Processing
file[/var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)
DEBUG: /var/cache/chef/DP_Bluetooth_wnt5_x86-32_910.torrent is about
to be hashed!
INFO: Found existing
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Bluetooth_wnt5_x86-32_910.7z]
in swarm with name of 'DP_Bluetooth_wnt5_x86-32_910.7z' and status of
'SEED'
DEBUG: Downloading
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Bluetooth_wnt5_x86-32_910.7z]...100%
complete

### CORE PROBLEM
# We should be done with Bluetooth right? No every torrent after that
reports a torrent hash = 4551e4bcfcd85ec04e0c28d5a151a0c1829fec19 and
doesn't get loaded into transmission.

# Begin processing DP_Chipset of the next torrent

DEBUG: Processing
remote_file[/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent]
on breeze.local
INFO: Processing
remote_file[/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent]
action create (unattended::default line 149)
DEBUG: 
remote_file[/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent]
checking for changes
DEBUG: 
remote_file[/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent]
checksum matches target checksum
(fcbcd23b21b29b36db2e5e7899b40757a3b40a006e3f837c6e7678a6477dc432) -
not updating
DEBUG: Processing
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Chipset_wnt5_x86-32_1108.7z]
on breeze.local
INFO: Processing
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Chipset_wnt5_x86-32_1108.7z]
action create (unattended::default line 156)
DEBUG: Caching a copy of torrent file
/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent
at /var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent
INFO: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)
DEBUG: /var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent is about to
be hashed!
DEBUG: 
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Chipset_wnt5_x86-32_1108.7z]
torrent hash = 4551e4bcfcd85ec04e0c28d5a151a0c1829fec19
DEBUG: Caching a copy of torrent file
/var/cache/chef/unattended/torrents/DP_Chipset_wnt5_x86-32_1108.torrent
at /var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent
DEBUG: Setting file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent]
to the state of the prior
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent]
INFO: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)

# Note that we should be about to hash this local torrent torrent file:

DEBUG: /var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent is about to
be hashed!

# However it matches the DP_Bluetooth swarm!!!!!

INFO: Found existing
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Chipset_wnt5_x86-32_1108.7z]
in swarm with name of 'DP_Bluetooth_wnt5_x86-32_910.7z' and status of
'SEED'

# And it thinks we are done without even loading our torrent file into
transmission!!!!

DEBUG: Downloading
transmission_torrent_file[/var/cache/chef/unattended/drivers/DP_Chipset_wnt5_x86-32_1108.7z]...100%
complete

# Still unsure why we have so many of these file processes

DEBUG: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] on
breeze.local
INFO: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)
DEBUG: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] on
breeze.local
INFO: Processing
file[/var/cache/chef/DP_Chipset_wnt5_x86-32_1108.torrent] action
create (/var/cache/chef/cookbooks/transmission/providers/torrent_file.rb
line 114)



Archive powered by MHonArc 2.6.16.

§