mirror of
https://abf.rosa.ru/djam/abf-console-client-src.git
synced 2025-02-23 09:52:48 +00:00
Fix config creation if it is missing
This commit is contained in:
parent
2203b591ea
commit
c492fa3707
4 changed files with 10 additions and 13 deletions
13
abf.py
13
abf.py
|
@ -23,12 +23,9 @@ gettext.install('abf-console-client')
|
|||
|
||||
from abf.console.config import Config, mkdirs
|
||||
from abf.console.log import Log
|
||||
log = Log('abf')
|
||||
|
||||
from abf.console.misc import *
|
||||
from abf.api.exceptions import *
|
||||
from abf.model import *
|
||||
|
||||
|
||||
configs_dir = '/etc/abf/mock-urpm/configs/'
|
||||
|
||||
def test():
|
||||
|
@ -1705,14 +1702,18 @@ def clean():
|
|||
|
||||
if __name__ == '__main__':
|
||||
global projects_cfg
|
||||
global cfg
|
||||
|
||||
parse_command_line()
|
||||
|
||||
if command_line.config:
|
||||
cfg = Config(command_line.config)
|
||||
cfg = Config(conf_path=command_line.config)
|
||||
log = Log('abf', conf_path=command_line.config)
|
||||
else:
|
||||
cfg = Config()
|
||||
log = Log('abf')
|
||||
|
||||
from abf.console.misc import *
|
||||
from abf.api.exceptions import *
|
||||
|
||||
abf_url = cfg['main']['abf_url']
|
||||
file_store_url = cfg['main']['file_store_url']
|
||||
|
|
|
@ -23,8 +23,8 @@ class Log:
|
|||
Log.set_verbose()
|
||||
logging.getLogger("").handlers[0].setLevel(logging.CRITICAL)
|
||||
|
||||
def __init__(self, name=''):
|
||||
logging.config.fileConfig(os.path.expanduser('~/.abfcfg'))
|
||||
def __init__(self, name='', conf_path='~/.abfcfg'):
|
||||
logging.config.fileConfig(os.path.expanduser(conf_path))
|
||||
self.log = logging.getLogger(name)
|
||||
|
||||
def __getattr__(self, attr):
|
||||
|
|
|
@ -16,6 +16,7 @@ import urllib2
|
|||
|
||||
from abf.console.log import Log
|
||||
from abf.api.exceptions import *
|
||||
|
||||
log = Log('models')
|
||||
|
||||
def mkdirs(path):
|
||||
|
@ -348,7 +349,6 @@ def pack_project(root_path):
|
|||
shutil.rmtree(f)
|
||||
|
||||
|
||||
|
||||
def execute_command(command, shell=False, cwd=None, timeout=0, raiseExc=True, print_to_stdout=False, exit_on_error=False, env=[]):
|
||||
output = ""
|
||||
start = time.time()
|
||||
|
|
|
@ -7,16 +7,12 @@ import string
|
|||
from datetime import datetime
|
||||
|
||||
from abf.api.exceptions import *
|
||||
#from abf.api.html import *
|
||||
from abf.api.jsn import *
|
||||
|
||||
|
||||
log = logging.getLogger('models')
|
||||
|
||||
lt_cache = Cache('abf', expire = 86400, type='file', data_dir='/tmp/abf_cache/data', lock_dir='/tmp/abf_cache/data')
|
||||
st_cache = Cache('abf', expire = 3600, type='file', data_dir='/tmp/abf_cache/data', lock_dir='/tmp/abf_cache/data')
|
||||
#lt_cache = None
|
||||
#st_cache = None
|
||||
|
||||
def get_cached(cache, cache_key, func, *args, **kwargs):
|
||||
if cache and cache.has_key(cache_key):
|
||||
|
|
Loading…
Add table
Reference in a new issue