GothenburgBitFactory / bugwarrior

Pull github, bitbucket, and trac issues into taskwarrior
http://pypi.python.org/pypi/bugwarrior
GNU General Public License v3.0
732 stars 209 forks source link

how can I put conditions around the targets #923

Closed bcohen44 closed 2 years ago

bcohen44 commented 2 years ago

Here is my situation...

I have 2 targets, gmail and github. THe github target is actually Github Enterprise, and only works behind my company firewall. So when bugwarrior-pull runs when not on VPN (or not in the office), it kicks off the gmail target worker first, then github. github target obviiously fails, pull stops, and it makes the gmail worker die.

How can I put a condition around the github target to only run when on VPN or on a specific network? I assume .bugwarriorrc cannot have if statements?

ryneeverett commented 2 years ago

I don't think there is currently any way to do this.

The development version of bugwarrior includes a feature that will allow succeeding services to finish even if some services fail (#825). However, I'd be wary of intentionally using this right now as it seems to be closing all tasks on connection failure (#866, #897).

Perhaps we should add a configuration option to set environment variables so you can set HTTP_PROXY on a per-service basis.

bcohen44 commented 2 years ago

I thought of a very hacky way to workaround my issues until #825 is resolved. I can have two .bugwarriorrc files, named differently. An shell script can check either my VPN status or ifconfig (or some network status), and based on what is active, copy in a .bugwarriorrc file with the targets declared that work. then I'll call this umbrella script from my crontab.

ryneeverett commented 2 years ago

Maybe the --flavor flag could allow you to use a single bugwarriorrc file. By my reading of the docs you should be able to have a different list of targets in each flavor section.

There's also the BUGWARRIORRC environment variable, by which you could direct bugwarrior to a different file path. Either way there should be no need to move files around.

bcohen44 commented 2 years ago

--flavor option is perfect, much better then cp files...thanks!

srl295 commented 2 years ago

Maybe the --flavor flag could allow you to use a single bugwarriorrc file. By my reading of the docs you should be able to have a different list of targets in each flavor section.

but note #874 you will get an error currently targets in the .ini file but not in targets=