def HandleManagement(arguments): if len(arguments) == 0: print(GetInfoMsg()) return SwarmTools.LoadEnvironmentVariables(arguments) SwarmTools.HandleDumpYamlData(arguments) if '-help' in arguments \ and not('-stack' in arguments) \ and not('-config' in arguments) \ and not('-secret' in arguments) \ and not('-network' in arguments): print(GetInfoMsg()) elif '-start' in arguments: StartSwarm(arguments) elif '-stop' in arguments: StopSwarm(arguments) elif '-restart' in arguments: RestartSwarm(arguments) else: SwarmVolumes.HandleVolumes(arguments) SwarmConfigs.HandleConfigs(arguments) SwarmSecrets.HandleSecrets(arguments) SwarmNetworks.HandleNetworks(arguments) SwarmStacks.HandleStacks(arguments)
def HandleManagement(arguments): if len(arguments) == 0: print(GetInfoMsg()) return if '-help' in arguments and len(arguments) == 1: print(GetInfoMsg()) return SwarmTools.LoadEnvironmentVariables( arguments, BuildTools.DEFAULT_BUILD_MANAGEMENT_YAML_FILES) SetDefaultCommonEnvVariables() SwarmTools.HandleDumpYamlData( arguments, BuildTools.DEFAULT_BUILD_MANAGEMENT_YAML_FILES) ChangelogSelections.HandleChangelogSelections(arguments) index = 0 while index < len(arguments): actionArgs, index = GetPositionalActionArguments(arguments, index) SwarmSelections.HandleSwarmSelections(actionArgs) BuildSelections.HandleBuildSelections(actionArgs) TestSelections.HandleTestSelections(actionArgs) RunSelections.HandleRunSelections(actionArgs) PublishSelections.HandlePublishSelections(actionArgs) PromoteSelections.HandlePromoteSelections(actionArgs)
def ExposeEnvironmentVariables(envVariables: [], swmInfrastructureFiles: []): for envVariable in envVariables: if not('=' in envVariable): warnings.warn('Cannot parse environment variable {0}. It should be of form <envKey>=<envValue>'.format(envVariable)) else: key = envVariable.split('=')[0] value = envVariable.split('=')[1] os.environ[key] = value if __CheckSwarmManagementYamlFileExists(yamlFiles=swmInfrastructureFiles): arguments = __GetSwarmManagementArgumentsWithInfrastructureFiles(swmInfrastructureFiles) SwarmTools.LoadEnvironmentVariables(arguments=arguments) if os.path.isfile('.env'): load_dotenv('.env')
def HandleManagement(arguments): if len(arguments) == 0: print(GetInfoMsg()) return if '-help' in arguments and len(arguments) == 1: print(GetInfoMsg()) return SwarmTools.LoadEnvironmentVariables( arguments, [BuildTools.DEFAULT_BUILD_MANAGEMENT_YAML_FILE]) SwarmTools.HandleDumpYamlData( arguments, [BuildTools.DEFAULT_BUILD_MANAGEMENT_YAML_FILE]) ChangelogSelections.HandleChangelogSelections(arguments) SwarmSelections.HandleSwarmSelections(arguments) BuildSelections.HandleBuildSelections(arguments) TestSelections.HandleTestSelections(arguments) RunSelections.HandleRunSelections(arguments) PublishSelections.HandlePublishSelections(arguments)