Don't track actual default configuration file. Instead create it from tracked default

This commit is contained in:
Oleksii Shevchuk 2016-08-19 20:24:20 +03:00
parent d8b492b5c7
commit bcb813f839
3 changed files with 5 additions and 0 deletions

1
.gitignore vendored
View File

@ -39,6 +39,7 @@ pupy/modules/lib/*.py[cod]
pupy/modules/lib/**/*.py[cod] pupy/modules/lib/**/*.py[cod]
pupy/network/**/*.pyc pupy/network/**/*.pyc
pupy/scriptlets/**/*.pyc pupy/scriptlets/**/*.pyc
pupy/pupy.conf
# do not ignore package & templates files # do not ignore package & templates files
!pupy/packages/ !pupy/packages/

View File

@ -29,6 +29,8 @@ from pupylib.utils.rpyc_utils import obtain
from .PupyTriggers import on_connect from .PupyTriggers import on_connect
from network.lib.utils import parse_transports_args from network.lib.utils import parse_transports_args
from network.lib.base_launcher import LauncherError from network.lib.base_launcher import LauncherError
from os import path
from shutil import copyfile
import network.conf import network.conf
import rpyc import rpyc
import shlex import shlex
@ -53,6 +55,8 @@ class PupyServer(threading.Thread):
self.clients_lock=threading.Lock() self.clients_lock=threading.Lock()
self.current_id=1 self.current_id=1
self.config = configparser.ConfigParser() self.config = configparser.ConfigParser()
if not path.exists('pupy.conf'):
copyfile('pupy.conf.default', 'pupy.conf')
self.config.read("pupy.conf") self.config.read("pupy.conf")
if port is None: if port is None:
self.port=self.config.getint("pupyd", "port") self.port=self.config.getint("pupyd", "port")