import time import docker import requests import yaml from yapl.utilities.Trace import Trace, Level import yapl.utilities.Utilities as Utilities from yapl.exceptions.Exceptions import ExitException from yapl.exceptions.Exceptions import MissingArgumentException from yapl.exceptions.ICPExceptions import ICPInstallationException from yapl.exceptions.AWSExceptions import AWSStackResourceException GetParameterSleepTime = 60 # seconds GetParameterMaxTryCount = 100 HelpFile = "nodeinit.txt" TR = Trace(__name__) """ The StackParameters are imported from the CloudFormation stack in the _init() method below. """ StackParameters = {} StackParameterNames = [] class EFSVolume: """ Simple class to manage an EFS volume. """ def __init__(self,efsServer,mountPoint): """
@author: Peter Van Sickel Module to support executing Docker commands as defined by yaml. WARNING: Only a very limited capability is supported. The bare minimum needed to do ICP installations. """ from subprocess import call from yapl.utilities.Trace import Trace from yapl.exceptions.Exceptions import MissingArgumentException from yapl.exceptions.Exceptions import InvalidArgumentException from yapl.utilities.cd import cd TR = Trace(__name__) """ DockerCommandArgs holds a list of recognized commands and the names of the attributes in the yaml file that define the command arguments. These arguments are "nameless" in the command line. In the yaml, the arguments get a name as noted in DockerCommandArgs table. The arguments are then added to the command line in the createCommands() or invokeCommands() methods. The nameless command arguments are added to the command line in the order they are defined in the DockerCommandArgs table. For example, for the docker run command the image and then the image-command string is added to the command in that order. The nameless command arguments are added to the command last, i.e., after all other flags, options, env vars, volume bindings, etc. """
#!/usr/bin/python import sys, os, time, stat from subprocess import call, check_call, CalledProcessError, Popen, check_output, PIPE import boto3 import socket import yaml from yapl.aws.LogExporter import LogExporter from yapl.utilities.Trace import Trace, Level from yapl.exceptions.Exceptions import MissingArgumentException from yapl.exceptions.ICPExceptions import ICPInstallationException from yapl.exceptions.Exceptions import ExitException from yapl.utilities import Utilities from bootstrap import Bootstrap TR = Trace(__name__) class ICPDBootstrap(object): ArgsSignature = { '--help': 'string', '--region': 'string', '--stack-name': 'string', '--stackid': 'string', '--role': 'string', '--logfile': 'string', '--loglevel': 'string', '--trace': 'string' } def __init__(self): """ Constructor