Greyhole - multiple sticky_files support
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
#1 Updated by gboudreau about 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 about 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 :)
#4 Updated by gboudreau about 11 years ago
- Assignee changed from gboudreau to cpg
See the default greyhole.conf for some details:
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.
#7 Updated by cpg about 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?
#13 Updated by cpg about 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 about 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.
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 about 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 about 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)
#20 Updated by gboudreau about 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...
#24 Updated by Huxy about 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!
Also available in: Atom