[DEV] update mode to check island is init

This commit is contained in:
Edouard DUPIN 2019-07-31 00:00:45 +02:00
parent bd7f732ca2
commit 8660b5b376
15 changed files with 53 additions and 61 deletions

View File

@ -55,11 +55,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -47,11 +47,8 @@ def execute(_arguments):
debug.info("Get data element: " + str(elem.get_arg())) debug.info("Get data element: " + str(elem.get_arg()))
cmd += elem.get_arg() + " " cmd += elem.get_arg() + " "
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -59,11 +59,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -50,11 +50,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -50,11 +50,8 @@ def execute(_arguments):
for elem in _arguments: for elem in _arguments:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -51,11 +51,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
debug.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'") debug.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
commands.fetch(env.get_island_path_manifest(), "origin") commands.fetch(env.get_island_path_manifest(), "origin")

View File

@ -14,6 +14,7 @@ from island import env
from island import config from island import config
from island import commands from island import commands
from island import multiprocess from island import multiprocess
from island import manifest
import os import os
## ##
@ -70,10 +71,9 @@ def execute(_arguments):
# check if .XXX exist (create it if needed) # check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == True \ if manifest.is_lutin_init() == True:
and os.path.exists(env.get_island_path_config()) == True \
and os.path.exists(env.get_island_path_manifest()) == True:
debug.error("System already init: path already exist: '" + str(env.get_island_path()) + "'") debug.error("System already init: path already exist: '" + str(env.get_island_path()) + "'")
tools.create_directory(env.get_island_path()) tools.create_directory(env.get_island_path())
# check if the git of the manifest if availlable # check if the git of the manifest if availlable

View File

@ -46,11 +46,8 @@ def execute(_arguments):
for elem in _arguments: for elem in _arguments:
debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -51,12 +51,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -56,12 +56,8 @@ def execute(_arguments):
else: else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()
file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name()) file_source_manifest = os.path.join(env.get_island_path_manifest(), configuration.get_manifest_name())

View File

@ -53,11 +53,8 @@ def execute(_arguments):
else: else:
debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'", ret_value=env.ret_action_wrong_parameters) debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'", ret_value=env.ret_action_wrong_parameters)
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'", ret_value=env.ret_manifest_is_not_existing)
configuration = config.Config() configuration = config.Config()

View File

@ -57,11 +57,8 @@ def execute(_arguments):
else: else:
debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed) # check system is OK
if os.path.exists(env.get_island_path()) == False \ manifest.check_lutin_is_init()
or os.path.exists(env.get_island_path_config()) == False \
or os.path.exists(env.get_island_path_manifest()) == False:
debug.error("System already init have an error: missing data: '" + str(env.get_island_path()) + "'")
configuration = config.Config() configuration = config.Config()

View File

@ -14,6 +14,7 @@ from island import env
from island import config from island import config
from island import commands from island import commands
from island import multiprocess from island import multiprocess
from island import manifest
import os import os
## ##
@ -70,6 +71,9 @@ def execute(_arguments):
debug.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'") debug.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'")
# check system is OK
manifest.check_lutin_is_init()
# Update the current configuration: # Update the current configuration:
conf = config.Config() conf = config.Config()
# TODO: Check if the local path does not exist in the manifest # TODO: Check if the local path does not exist in the manifest

View File

@ -14,6 +14,7 @@ from island import env
from island import config from island import config
from island import commands from island import commands
from island import multiprocess from island import multiprocess
from island import manifest
import os import os
## ##
@ -37,6 +38,10 @@ def help():
def execute(_arguments): def execute(_arguments):
for elem in _arguments: for elem in _arguments:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'") debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check system is OK
manifest.check_lutin_is_init()
conf = config.Config() conf = config.Config()
volatiles = conf.get_volatile() volatiles = conf.get_volatile()
debug.info("List of all volatiles repository: ") debug.info("List of all volatiles repository: ")

View File

@ -27,6 +27,24 @@ class RepoConfig():
self.select_remote = "" self.select_remote = ""
self.branch = "" self.branch = ""
def is_lutin_init():
if os.path.exists(env.get_island_path()) == False:
debug.verbose("Lutin is not init: path does not exist: '" + env.get_island_path() + "'")
return False
if os.path.exists(env.get_island_path_config()) == False \
and os.path.exists(env.get_island_path_config_old()) == False:
debug.verbose("Lutin is not init: config does not exist: '" + env.get_island_path_config() + "' or '" + env.get_island_path_config_old() + "'")
return False
if os.path.exists(env.get_island_path_manifest()) == False:
debug.verbose("Lutin is not init: Manifest does not exist: '" + env.get_island_path_manifest() + "'")
return False
return True
def check_lutin_is_init():
# check if .XXX exist (create it if needed)
if is_lutin_init() == False:
debug.error("System not init: missing config: '" + str(env.get_island_path()) + "'. Call <island init> first")
exit(-1)
class Manifest(): class Manifest():
def __init__(self, manifest_xml): def __init__(self, manifest_xml):