def is_docker_present(): try: vm_type = docker.vm_type() docker.validate_docker_vm(vm_type) return True except DockerValidationError: return False
def run(): # Parse arguments parser = build_parser() argcomplete.autocomplete(parser) args = parser.parse_args() # Print help or execute subparser function if not vars(args).get('func'): parser.print_help() # Validate image_version elif vars(args).get('func').__name__ == 'run' and not args.image_version: parser.exit('The version of the ConductR Docker image must be set.\n' 'Please visit https://www.lightbend.com/product/conductr/developer ' 'to obtain the current version information.') # Call sandbox function elif vars(args).get('func').__name__ == 'version': logging_setup.configure_logging(args) args.func(args) else: logging_setup.configure_logging(args) # Check that all feature arguments are valid if vars(args).get('func').__name__ == 'run': if args.features and args.no_wait: parser.exit('Option --no-wait is not allowed when starting ConductR with option --feature') invalid_features = [f for f, *a in args.features if f not in feature_names] if invalid_features: parser.exit('Invalid features: %s (choose from %s)' % (', '.join("'%s'" % f for f in invalid_features), ', '.join("'%s'" % f for f in feature_names))) # Docker VM validation args.vm_type = docker.vm_type() validate_docker_vm(args.vm_type) args.func(args)
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info( headline( 'Starting logging feature based on elasticsearch and kibana' )) log.info( 'conductr-kibana bundle is packaged as a Docker image. Checking Docker requirements..' ) docker.validate_docker_vm(docker.vm_type()) log.info('Docker is installed and configured correctly.') elasticsearch = select_bintray_uri('conductr-elasticsearch', self.version_args) log.info('Deploying bundle %s..' % elasticsearch['bundle']) elasticsearch_load_command = ['load', elasticsearch['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(elasticsearch_load_command, configure_logging=False) conduct_main.run( ['run', elasticsearch['name'], '--disable-instructions'], configure_logging=False) kibana = select_bintray_uri('conductr-kibana', self.version_args) log.info('Deploying bundle %s..' % kibana['bundle']) kibana_load_command = ['load', kibana['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(kibana_load_command, configure_logging=False) conduct_main.run([ 'run', kibana['name'], '--disable-instructions', '--wait-timeout', '600' ], configure_logging=False)
def run(_args=[], configure_logging=True): # Parse arguments if not _args: _args = sys.argv[1:] parser = build_parser() argcomplete.autocomplete(parser) args = parser.parse_args(_args) # Print help or execute subparser function if not vars(args).get('func'): parser.print_help() # Validate image_version elif vars(args).get('func').__name__ == 'run' and not args.image_version: parser.exit( 'The version of ConductR need to be set.\n' 'Please visit https://www.lightbend.com/product/conductr/developer ' 'to obtain the current version information.') # Call sandbox function elif vars(args).get('func').__name__ == 'version': logging_setup.configure_logging(args) args.func(args) else: if configure_logging: logging_setup.configure_logging(args) # Check that all feature arguments are valid if vars(args).get('func').__name__ == 'run': invalid_features = [ f for f, *a in args.features if f not in feature_names ] if invalid_features: parser.exit('Invalid features: %s (choose from %s)' % (', '.join("'%s'" % f for f in invalid_features), ', '.join( "'%s'" % f for f in feature_names))) conflicting_features = feature_conflicts( [name for name, *args in args.features]) if len(conflicting_features) > 0: messages = [] for p, fs in conflicting_features.items(): messages.append("'{0}' provided by ({1})".format( p, ', '.join(map(lambda e: "'" + e + "'", fs)))) parser.exit('Conflicting features: {0}'.format( ', '.join(messages))) # Docker VM validation args.vm_type = docker.vm_type() if vars(args).get( 'func').__name__ == 'run' and is_sandbox_docker_based( args.image_version): docker.validate_docker_vm(args.vm_type) result = args.func(args) if not result: sys.exit(1)
def run(): # Parse arguments parser = build_parser() argcomplete.autocomplete(parser) args = parser.parse_args() # Print help or execute subparser function if not vars(args).get('func'): parser.print_help() # Validate image_version elif vars(args).get('func').__name__ == 'run' and not args.image_version: parser.exit('The version of ConductR need to be set.\n' 'Please visit https://www.lightbend.com/product/conductr/developer ' 'to obtain the current version information.') # Call sandbox function elif vars(args).get('func').__name__ == 'version': logging_setup.configure_logging(args) args.func(args) else: logging_setup.configure_logging(args) # Check that all feature arguments are valid if vars(args).get('func').__name__ == 'run': if args.features and args.no_wait: parser.exit('Option --no-wait is not allowed when starting ConductR with option --feature') invalid_features = [f for f, *a in args.features if f not in feature_names] if invalid_features: parser.exit('Invalid features: %s (choose from %s)' % (', '.join("'%s'" % f for f in invalid_features), ', '.join("'%s'" % f for f in feature_names))) # Docker VM validation args.vm_type = docker.vm_type() if vars(args).get('func').__name__ == 'run' and major_version(args.image_version) == 1: docker.validate_docker_vm(args.vm_type) result = args.func(args) if not result: exit(1)
def resolve(): vm_type = docker.vm_type() return resolve_ip_by_vm_type(vm_type)