Depending on how I am getting my network connection there are cases where I want to never access a remote. BUT it depends on the network connection.
For example, when I'm roaming (and paying excessively for each byte)
- I really don't want my music annex to ever hit some site (like S3 / Glacier), BUT
- I do want to be able to get from a remote (like Glacier) for my work annex.
But if I'm home, then all's fair.
That means I can't do something simple like blocking a particular address/IP with DNS (or whatever). Or even not having the remote listed.
So... I was thinking of using annex-cost-command
to allow me to set the cost of remotes, based on (say) my IP, but also the annex. Thus it would result in
- [roaming] + [work-annex] == veryExpensiveRemoteCost
- [roaming] + [music-annex] == Blocked
However I still need a way to say "never, ever, ever" for the cost of some remotes.
Is this possible? (With my cursory looking at the code, I can't see anything.)
Just to clarify...
There will be situations where I will want to access other remotes (either networked or special, like an external drive) when I'm blocking access to others (like Glacier).
So, for the music annex example when I'm roaming:
...and in this case if there are files that are only available on Glacier, I'm happy to live without them.
And for the work example, again when roaming:
...but if there is a file I need on Glacier and no where else, then just get it.
Cost settings only affect sort order, they don't allow completely blocking use of a remote.
I feel that it would be perhaps the wrong design to extend cost settings into blocking a remote.
There's also the
remote.<name>.annex-start-command
hook. However, failure to run its command does not prevent git-annex from trying to access a remote.I think it would be reasonable to add a hook
remote.<name>.annex-check-command
. If set, the command would have to succed, or git-annex would refuse to use the remote.Another good reason to have a separate config is it should probably block
git annex sync
from pulling/pushing the remote. Cost does not affect pulling and pushing.The two config settings
annex-ignore
andannex-sync
are the non-dynamic ways to control this. So perhaps the way that annex-cost-command is the dynamic form of annex-cost, there ought to be annex-ignore-command and annex-sync-command.That also allows for situations like a network where you want git-annex sync to only push the git repository but not annexed contents.
Brilliant - Thanks Joey!
...and that's why I donated.