0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pybatfishの向き先batfishサーバを変更する

Posted at

はじめに

windowsでbatfishを使うpythonプログラムを開発する際
windows上にDocker環境は構築せずに Linuxサーバ上に構築済みのBatfishをwindowsから使いたかった。

サーバ: Dockerイメージbatfish/batfishでコンテナ起動
ローカルPC: batfish/pybatfishを使ってサーバ上のbatfishを利用

実現方法

pybatfish/client/options.py に記載のhostを変更する のみ!

(windows venv上にpybatfishをインストールしている場合)
venvディレクトリ/Lib/site-packages/pybatfish/client/options.py

(ついでにlinux venvの場合)
venvディレクトリ/lib/python3.6/site-packages/pybatfish/client/options.py

options.py
class Options(object):
     
    # coordinatior_host = "localhost"  # type: str
    coordinatior_host = "<サーバのIPアドレス>"  # type: str

のように変更。

これで例えば

from pybatfish.client.commands import *
from pybatfish.question.question import load_questions, list_questions
from pybatfish.question import bfq

load_questions()
bf_init_snapshot(<zip file or directory>) 

をwindows上で実行するとサーバのdocker上にsnapshotファイルが作成されます。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?