[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:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -47,11 +47,8 @@ def execute(_arguments):
debug.info("Get data element: " + str(elem.get_arg()))
cmd += elem.get_arg() + " "
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -59,11 +59,8 @@ def execute(_arguments):
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -50,11 +50,8 @@ def execute(_arguments):
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -50,11 +50,8 @@ def execute(_arguments):
for elem in _arguments:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -51,11 +51,8 @@ def execute(_arguments):
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
debug.info("fetch manifest : '" + str(env.get_island_path_manifest()) + "'")
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 commands
from island import multiprocess
from island import manifest
import os
##
@ -70,10 +71,9 @@ def execute(_arguments):
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == True \
and os.path.exists(env.get_island_path_config()) == True \
and os.path.exists(env.get_island_path_manifest()) == True:
if manifest.is_lutin_init() == True:
debug.error("System already init: path already exist: '" + str(env.get_island_path()) + "'")
tools.create_directory(env.get_island_path())
# check if the git of the manifest if availlable

View File

@ -46,11 +46,8 @@ def execute(_arguments):
for elem in _arguments:
debug.error("pull Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -51,12 +51,8 @@ def execute(_arguments):
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -56,12 +56,8 @@ def execute(_arguments):
else:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()
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:
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)
if os.path.exists(env.get_island_path()) == False \
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)
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -57,11 +57,8 @@ def execute(_arguments):
else:
debug.error("SYNC Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check if .XXX exist (create it if needed)
if os.path.exists(env.get_island_path()) == False \
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()) + "'")
# check system is OK
manifest.check_lutin_is_init()
configuration = config.Config()

View File

@ -14,6 +14,7 @@ from island import env
from island import config
from island import commands
from island import multiprocess
from island import manifest
import os
##
@ -70,6 +71,9 @@ def execute(_arguments):
debug.info("Add 'volatile' repository: '" + address_git + "' path='" + path + "'")
# check system is OK
manifest.check_lutin_is_init()
# Update the current configuration:
conf = config.Config()
# 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 commands
from island import multiprocess
from island import manifest
import os
##
@ -37,6 +38,10 @@ def help():
def execute(_arguments):
for elem in _arguments:
debug.error("Wrong argument: '" + elem.get_option_name() + "' '" + elem.get_arg() + "'")
# check system is OK
manifest.check_lutin_is_init()
conf = config.Config()
volatiles = conf.get_volatile()
debug.info("List of all volatiles repository: ")

View File

@ -26,7 +26,25 @@ class RepoConfig():
self.remotes = [] # list of all remotes, with the upstream elements (needed for third party integrations)
self.select_remote = ""
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():
def __init__(self, manifest_xml):