Project

General

Profile

Feature #591

Greyhole - multiple sticky_files support

Added by Huxy almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/01/2010
Due date:
% Done:

100%


Description

At the moment the /var/hda/platform/html/config/greyhole.yml file in Amahi only supports one sticky_files line.
In order to allow multiple shares to support sticky_files the user should be able to change this option inside the storage pool or shares section on the dashboard.
The resultant greyhole.yml and greyhole.conf should then reflect these settings.

This feature request is a result of the following topic http://forums.amahi.org/viewtopic.php?f=39&t=1658

History

#1 Updated by gboudreau almost 11 years ago

This don't need to be editable in the dashboard; greyhole.yml was made for advanced users, to further customize Greyhole.
But it needs to support multiple sticky_files lines, each of which should become a sticky_files line in greyhole.conf, when automatically generated.
At this time, only the last line is put in greyhole.conf; the previous ones are just ignored.

There is also a stick_into config option available in greyhole.conf, that can (it's optional) follow each sticky_files line.
Maybe you should add support for that while you're in there.
sticky_files and stick_into ordering is important; i.e. the stick_into line needs to follow the sticky_files it applies to.

#2 Updated by cpg almost 11 years ago

this does not seem too hard at all.

can you specify it in all detail?
(i am out of context)

the default looks like this:

"sticky_files" => "Music/"

then any options in the greyhole.yml file are 'merged' in as a hash.

it looks like sticky_files needs to be split?

spell it out and send this bug back to me please :)

#3 Updated by cpg almost 11 years ago

  • Assignee set to gboudreau

#4 Updated by gboudreau almost 11 years ago

  • Assignee changed from gboudreau to cpg

See the default greyhole.conf for some details:
http://code.google.com/p/greyhole/source/browse/trunk/greyhole.example.conf

i.e. you can have multiple sticky_files and stick_into lines in your conf.
So you can't use a hash.

Example excerpt from greyhole.conf:

sticky_files = Music/
sticky_files = Videos/Movies/
    stick_into = /mnt/hdd1/gh
    stick_into = /mnt/hdd5/gh
sticky_files = Backups/CrashPlan/*/
    stick_into = /mnt/hdd0/gh

Note: Indentation of the stick_into lines is ignored when reading the conf file; it's just easier to understand like this.

#5 Updated by cpg almost 11 years ago

ok, a nested list should be fine then.

does the stick_into order matter?

#6 Updated by gboudreau almost 11 years ago

Yes. They should appear in the exact same order as entered in the greyhole.yml

#7 Updated by cpg almost 11 years ago

ok, specifying as a nested list will do. the example above, when written exactly like this (indentation does matter in YAML files) ought to work:

sticky_files: 
- - Music/
- - Videos/Movies/
  - - /mnt/hdd1/gh
    - /mnt/hdd5/gh
- - Backups/CrashPlan/*/
  - - /mnt/hdd0/gh

this kind of requires people to understand precisely the indentation that YAML expects.

is this an acceptable solution?

#8 Updated by gboudreau almost 11 years ago

Yes. Maybe just add a comment above those to mention how to properly use indentation for those.

#9 Updated by cpg almost 11 years ago

how about if instead we add a comment with a link to some place in the wiki?

rather not carry that around in the code.

also, just to be clear, ALL the other options are a hash and their order does NOT matter. correct?

#10 Updated by gboudreau almost 11 years ago

Good idea, and yes.

#11 Updated by cpg almost 11 years ago

ok. while i work on the test rpm, can you guys make a link in the appropriate place in the wiki (somewhere in the greyhole pages, i imagine) and provide it here?

maybe populate with the example above and i will add docs later.

#13 Updated by cpg almost 11 years ago

can you guys try this rpm: http://alpha.amahi.org/tmp/hda-platform-5.4.8-1.noarch.rpm

to test, please first install it without doing anything to the existing formatting and make one or more changes to the storage pooling area, then make sure it works as is.

then change the stick_files to the new format, the default being this:

sticky_files:
- - Music/

then make changes to the storage pooling area to get the .conf file re-generated

#14 Updated by Huxy almost 11 years ago

  • File error.png added

Just a headsup. I installed the rpm but it broke the amahi dashboard.
I've attached the error message, however the fix appeared to be fairly simple.

Line 116:

settings << sticky_files_to_s(gs["sticky_files")

is missing corresponding ']'

settings << sticky_files_to_s(gs["sticky_files"])

I will test the greyhole changes and report the results.

#15 Updated by Huxy almost 11 years ago

  • File error2.png added

Ok, I've just tried to edit the shares and enable pooling on a share but got an application error. I'm not really sure whats caused that error. I'm running the bog standard install apart from the hda-platform rpm that was provided.

I've attached another screenshot showing the error and apologise if you prefer not to have images uploaded but I often find its easier to show the problem then to describe it.

#16 Updated by cpg almost 11 years ago

ugh. famous last minute trivial change bit me right in the ass.

updated the url to the new rpm. please test it.

also, immediately after the error helps please go to the debug tab and submit a debug report
(or find the production.log and submit the error from there)

#17 Updated by Huxy almost 11 years ago

Just submitted the debug report as requested.

#18 Updated by Huxy almost 11 years ago

  • File production.log added

Here's the production.log. It only contains the lines relating to the error.

#19 Updated by gboudreau almost 11 years ago

It's a typo on the same line!

settings << sticky_files_to_s(gs["sticky_files"])
should be
settings << sticky_files_to_s(gh["sticky_files"])

i.e. gh, not gs... :)

#20 Updated by gboudreau almost 11 years ago

After fixing that, I now get:

NoMethodError (undefined method `class=' for "Music/":String):
  lib/greyhole.rb:115:in `sticky_files_to_s'
  lib/greyhole.rb:106:in `header'
  lib/greyhole.rb:65:in `greyhole_conf'
  lib/greyhole.rb:42:in `save_conf_file'

This is with the old setting, but I don't think it matters. It doesn't seem to like that = character there...

#21 Updated by Huxy almost 11 years ago

Interestingly, I changed the line to read gh not gs but I still get an application error :S

#22 Updated by gboudreau almost 11 years ago

On line 115, the = should be a ==

After that last change, it worked fine with the old setting in greyhole.yml

(Huxy: service httpd restart)

#23 Updated by gboudreau almost 11 years ago

New format works too.

I just saw this in the generated greyhole.conf. I don't think those should be there; they are instructions for greyhole.yml:

# add any group of other settings
# here in multiple lines

#24 Updated by Huxy almost 11 years ago

Ahhh! the old assignment isnt the same as equality operator - how did I miss that trick!

Thanks for the heads up as restarting httpd also worked (I presume its due to the way ruby on rails and mod_passenger caching work)
I've also just finished testing. I tried various folders/shares/drive settings and can confirm that the new format is working correctly.

With regards to the two comment lines, if I remember correctly, those two lines above were already in the greyhole.conf and are not a direct result of this file change.
Thanks for the work/time/effort on this!

#25 Updated by cpg almost 11 years ago

shit, my bad for the typo. hda-platform-5.4.8-1.noarch.rpm is out.

#26 Updated by cpg almost 11 years ago

  • Project changed from apps to platform
  • Category deleted (Greyhole)

#27 Updated by Anonymous almost 11 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:"b06b145e1af15a7ffe4b13ff824ac01a3cdb8944".

#28 Updated by cpg almost 11 years ago

  • File deleted (production.log)

#29 Updated by cpg almost 11 years ago

  • File deleted (error.png)

#30 Updated by cpg almost 11 years ago

  • File deleted (error2.png)

Also available in: Atom