def compile_operation_queue(commandlist): command = commandlist[0] subcommand = commandlist[1] subcommand = _fill_default_subcommand(command, subcommand) queue = OperationQueue() if command == CommandType.INIT: queue.add(TryLoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(AskForConfigFileParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(RotateOptionsettingFileOperation(queue)) queue.add(SanitizeBranchOperation(queue)) queue.add(UpdateAwsCredentialFileOperation(queue)) queue.add(SanitizeAppVersionNameOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) queue.add(UpdateDevToolsConfigOperation(queue)) queue.add(CheckGitIgnoreFileOperation(queue)) elif command == CommandType.START: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(CreateApplicationOperation(queue)) queue.add(CreateApplicationVersionOperation(queue)) queue.add(CreateEnvironmentOperation(queue)) queue.add(SleepOperation(queue)) queue.add(SaveConfigurationSettingOperation(queue)) queue.add(WaitForCreateEnvironmentFinishOperation(queue)) elif command == CommandType.UPDATE: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(UpdateEnvOptionSettingOperation(queue)) queue.add(WaitForUpdateEnvOptionSettingFinishOperation(queue)) elif command == CommandType.STATUS: queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(DescribeEnvironmentOperation(queue)) elif command == CommandType.STOP: queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(SaveConfigurationSettingOperation(queue)) queue.add(RecordApplicationVersionOperation(queue)) queue.add(TerminateEnvironmentOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) queue.add(WaitForTerminateEnvironmentFinishOperation(queue)) elif command == CommandType.DELETE: queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(DeleteApplicationOperation(queue)) queue.add(SanitizeRdsPasswordOperation(queue)) queue.add(SanitizeAppVersionNameOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) elif command == CommandType.BRANCH: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(RegisterBranchOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(UpdateAwsCredentialFileOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) elif command == CommandType.LOGS: queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(EnvRequestLogOperation(queue)) queue.add(EnvRetrieveLogOperation(queue)) elif command == CommandType.EVENTS: queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(GetEnvironmentEventsOperation(queue)) elif command == CommandType.PUSH: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(PushApplicationVersionOperation(queue)) queue.add(WaitForUpdateEnvOptionSettingFinishOperation(queue)) else: _error_out(command, subcommand) return queue
def compile_operation_queue(command): queue = OperationQueue() if command == CommandType.INIT: queue.add(TryLoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(AskForConfigFileParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(RotateOptionsettingFileOperation(queue)) queue.add(SanitizeBranchOperation(queue)) queue.add(UpdateAwsCredentialFileOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) queue.add(UpdateDevToolsConfigOperation(queue)) queue.add(CheckGitIgnoreFileOperation(queue)) elif command == CommandType.START: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) # queue.add(SaveEbConfigFileOperation(queue)) queue.add(UpdateDevToolsConfigOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(CreateApplicationOperation(queue)) queue.add(CreateApplicationVersionOperation(queue)) queue.add(CreateEnvironmentOperation(queue)) queue.add(SleepOperation(queue)) queue.add(SaveConfigurationSettingOperation(queue)) queue.add(WaitForCreateEnvironmentFinishOperation(queue)) elif command == CommandType.UPDATE: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(UpdateEnvOptionSettingOperation(queue)) queue.add(WaitForUpdateEnvOptionSettingFinishOperation(queue)) elif command == CommandType.STATUS: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(DescribeEnvironmentOperation(queue)) elif command == CommandType.STOP: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(SaveConfigurationSettingOperation(queue)) queue.add(TerminateEnvironmentOperation(queue)) queue.add(WaitForTerminateEnvironmentFinishOperation(queue)) elif command == CommandType.DELETE: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) # queue.add(TryGetCurrentBranchOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(AskConfirmationOperation(queue)) queue.add(DeleteApplicationOperation(queue)) # queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(SanitizeRdsPasswordOperation(queue)) elif command == CommandType.BRANCH: queue.add(CheckGitIgnoreFileOperation(queue)) queue.add(LoadEbConfigFileOperation(queue)) queue.add(ReadAwsCredentialFileOperation(queue)) queue.add(AskForMissiongParameterOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(RegisterBranchOperation(queue)) queue.add(ValidateParameterOperation(queue)) queue.add(UpdateAwsCredentialFileOperation(queue)) queue.add(SaveEbConfigFileOperation(queue)) else: AttributeError(unicode.format("Not supported command: {0}", command)) return queue