deploy the container
target - target to deploy to
system - the target system defintinion
cdef - the contianer definition
container - the container as defined in the system topology
out - ouput stream
cb - complete callback
167760
function deploy(mode, target, system, containerDef, container, out, cb) {
    var executor = prepareAndGetExecutor(target, out, 'deploying');
    executor.deploy(mode, target, system, containerDef, container, out, function(err) {
      cb(err);
    });
  }
121429
private function initContainer()
    {
        $dicons = (array)$this->app->config('container.dicon');
        $container = ContainerFactory::create();
        foreach ($dicons as $dicon) {
            $file = $this->app->getLoader()->find($dicon)->first();
            $container->import($file);
        }

        $container->register('framework', $this);
        $container->register('application', $this->app);
        $container->register('loader', $this->app->getLoader());

        $this->setContainer($container);
        $this->app->setContainer($container);

        // callback
        foreach ((array)$this->app->config('container.callback.initialized') as $callback) {
            $callback($container);
        }
    }
127615
private void deploy(ClassLoader cl, String name) throws Throwable
   {
      if (cl == null)
         throw new IllegalArgumentException("ClassLoader is null");

      if (name == null)
         throw new IllegalArgumentException("Name is null");

      URL url = cl.getResource(name);

      if (url == null)
         throw new IllegalArgumentException("Resource is null");

      log.debugf("Deploying: %s", url);

      kernel.getMainDeployer().deploy(url);
   }
346529
function endStream(cb) {
        // If no files were passed in, no files go out ...
        if (!latestFile || (Object.keys(concats).length === 0 && concats.constructor === Object)) {
            cb();
            return;
        }

        // Prepare a method for pushing the stream
        const pushJoinedFile = (joinedBase) => {
            const joinedFile = new File({
                path: joinedBase,
                contents: concats[joinedBase].concat.content,
                stat: concats[joinedBase].stats
            });
            if (concats[joinedBase].concat.sourceMapping) {
                joinedFile.sourceMap = JSON.parse(concats[joinedBase].concat.sourceMap);
            }
            this.push(joinedFile);
            delete concats[joinedBase];
        };

        // Refine the dependency graph
        const refinedDependencyMap = [];
        dependencyGraph.forEach(edge => {
            if ((edge[0] in nameBaseMap) && (edge[1] in nameBaseMap)) {
                refinedDependencyMap.push([nameBaseMap[edge[0]], nameBaseMap[edge[1]]]);
            }
        });
        const sortedDependencies = refinedDependencyMap.length ? toposort(refinedDependencyMap).reverse() : [];
        sortedDependencies.map(pushJoinedFile);

        // Run through all registered contact instances
        for (const targetBase in concats) {
            pushJoinedFile(targetBase);
        }
        cb();
    }
718686
protected AbstractBeanDeployer<E> deploySpecialized() {
        // ensure that all decorators are initialized before initializing
        // the rest of the beans
        for (DecoratorImpl<?> bean : getEnvironment().getDecorators()) {
            bean.initialize(getEnvironment());
            containerLifecycleEvents.fireProcessBean(getManager(), bean);
            manager.addDecorator(bean);
            BootstrapLogger.LOG.foundDecorator(bean);
        }
        for (InterceptorImpl<?> bean : getEnvironment().getInterceptors()) {
            bean.initialize(getEnvironment());
            containerLifecycleEvents.fireProcessBean(getManager(), bean);
            manager.addInterceptor(bean);
            BootstrapLogger.LOG.foundInterceptor(bean);
        }
        return this;
    }
154197
def replace_container(self, new_target_image_name, go_home=None):
		
		shutit = self.shutit
		shutit.log('Replacing container with ' + new_target_image_name + ', please wait...', level=logging.DEBUG)
		shutit.log(shutit.print_session_state(), level=logging.DEBUG)

		# Destroy existing container.
		conn_module = None
		for mod in shutit.conn_modules:
			if mod.module_id == shutit.build['conn_module']:
				conn_module = mod
				break
		if conn_module is None:
			shutit.fail('''Couldn't find conn_module ''' + shutit.build['conn_module']) # pragma: no cover
		container_id = shutit.target['container_id']
		conn_module.destroy_container(shutit, 'host_child', 'target_child', container_id)

		# Start up a new container.
		shutit.target['docker_image'] = new_target_image_name
		target_child = conn_module.start_container(shutit, self.pexpect_session_id)
		conn_module.setup_target_child(shutit, target_child)
		shutit.log('Container replaced', level=logging.DEBUG)
		shutit.log(shutit.print_session_state(), level=logging.DEBUG)
		# New session - log in. This makes the assumption that we are nested
		# the same level in in terms of shells (root shell + 1 new login shell).
		target_child = shutit.get_shutit_pexpect_session_from_id('target_child')
		if go_home != None:
			target_child.login(ShutItSendSpec(self,
			                                  send=shutit_global.shutit_global_object.bash_startup_command,
			                                  check_exit=False,
			                                  echo=False,
			                                  go_home=go_home))
		else:
			target_child.login(ShutItSendSpec(self,
			                                  send=shutit_global.shutit_global_object.bash_startup_command,
			                                  check_exit=False,
			                                  echo=False))
		return True
721306
function needBuild(mode, system, cdef, out, cb) {
    // TODO handle authentication and HTTPS registries
    // also handle other registries than docker-registry-container

    var cmds = commands(os.platform());
    var tag = cmds.generateTag(config, system, cdef);
    var baseUrl = 'http://' + config.registry + '/v1/repositories';
    var url = tag.replace(config.registry,
                          baseUrl) + '/tags';

    request({ url: url, json: true }, function(err, res, body) {
      if (err) { return cb(err); }

      // return the missing definition, or null
      cb(null, Object.keys(body).length === 0 ? cdef : null);
    });
  }
699892
def create_dependency_on(target)
      
      @properties['target'] = target.identifier
      
      container_item_proxy = ContainerItemProxy.default target.project.project.identifier, target.identifier, target.name
      container_item_proxy = @registry.add_object(container_item_proxy)
      
      @properties['targetProxy'] = container_item_proxy.identifier
      
      save!
    end
346039
public void deployManaged(@Observes DeployManagedDeployments event) throws Exception {
        forEachManagedDeployment(new Operation<Container, Deployment>() {
            @Inject
            private Event<DeploymentEvent> event;

            @Override
            public void perform(Container container, Deployment deployment) throws Exception {
                //when a container is manually controlled, the deployment is deployed automatically
                //once the container is manually started, not now
                if (!"manual".equals(container.getContainerConfiguration().getMode())) {
                    if (container.getState() != State.STARTED) {
                        throw new IllegalStateException("Trying to deploy a managed deployment "
                            + deployment.getDescription().getName()
                            + " to a non started managed container "
                            + container.getName());
                    }
                    event.fire(new DeployDeployment(container, deployment));
                }
            }
        });
    }
456181
void createImage( String imageId ) throws TargetException {

		// If there is no Dockerfile, this method will do nothing
		File targetDirectory = this.parameters.getTargetPropertiesDirectory();
		String dockerFilePath = this.parameters.getTargetProperties().get( GENERATE_IMAGE_FROM );
		if( ! Utils.isEmptyOrWhitespaces( dockerFilePath ) && targetDirectory != null ) {

			this.logger.fine( "Trying to create image " + imageId + " from a Dockerfile." );
			File dockerFile = new File( targetDirectory, dockerFilePath );
			if( ! dockerFile.exists())
				throw new TargetException( "No Dockerfile was found at " + dockerFile );

			// Start the build.
			// This will block the current thread until the creation is complete.
			String builtImageId;
			this.logger.fine( "Asking Docker to build the image from our Dockerfile." );
			try {
				builtImageId = this.dockerClient
					.buildImageCmd( dockerFile )
					.withTags( Sets.newHashSet( imageId ))
					.withPull( true )
					.exec( new RoboconfBuildImageResultCallback())
					.awaitImageId();

			} catch( Exception e ) {
				Utils.logException( this.logger, e );
				throw new TargetException( e );
			}

			// No need to store the real image ID... Docker has it.
			// Besides, we search images by both IDs and tags.
			// Anyway, we can log the information.
			this.logger.fine( "Image '" + builtImageId + "' was succesfully generated by Roboconf." );
		}
	}
818623
function (cb) {
			if (!o1.options.useCDN)
				return cb();

			o1._log('CDN enabling the container');

			container.enableCdn(function (err, _container) {
				if (err)
					return cb(err);

				// check that a parallel operation didn't just CDN enable the same container
				var index = _.findIndex(o1.aContainers, { name : sName });

				container = o1.aContainers[index] = _container;

				cb();
			});
		}
54725
function undeploy(mode, target, system, containerDef, container, out, cb) {
    logger.info('undeploying');
    out.stdout('undeploying');
    cb();
  }
1318526
function start(mode, target, system, containerDef, container, out, cb) {

    out.preview({cmd: 'start instances', host: null, user: null, keyPath: null});
    if (mode === 'preview') {
      return cb(null);
    }

    var instanceType = container.specific.InstanceType ||
                       container.specific.instanceType ||
                       config.defaultInstanceType ||
                       'm3.medium';

    var imageId = container.specific.ImageId ||
                  container.specific.imageId ||
                  config.defaultImageId;

    var params = {'MaxCount': 1,
                  'MinCount': 1,
                  'EbsOptimized': false,
                  'InstanceInitiatedShutdownBehavior': 'stop',
                  'InstanceType': instanceType,
                  'ImageId': imageId,
                  'KeyName': config.defaultKeyName,
                  'SubnetId': config.defaultSubnetId,
                  'Monitoring': { Enabled: false }};
                  /*'EbsOptimized': container.specific.ebsOptimized,
                  'InstanceInitiatedShutdownBehavior': container.specific.instanceInitiatedShutdownBehavior,
                  'InstanceType': container.specific.instanceType,
                  'KeyName': container.specific.keyName,
                  'Monitoring': container.specific.monitoring};*/

    if (system.topology.containers[container.containedBy].type === 'aws-sg') {
      params.SecurityGroupIds = [system.topology.containers[container.containedBy].nativeId];
    }

    _ec2.runInstances(params, function(err, data) {
      if (err) { return cb(err, null); }
      var instance = data.Instances[0];

      pollInstanceStart(instance, function(err, newSpecific) {
        if (err) { return cb(err); }
        var tagParams = {Resources: [instance.InstanceId], Tags: container.specific.tags || []};
        tagParams.Tags.push({Key: 'nscale-system', Value: system.name + '-' + system.topology.name});
        tagParams.Tags.push({Key: 'nscale-id', Value: system.name + '-' + system.topology.name + '-' + container.id});
        if (containerDef.name) {
          tagParams.Tags.push({Key: 'Name', Value: container.id});
        }
        _ec2.createTags(tagParams, function() {
          if (err) { return cb(err); }
          var c = _.find(system.topology.containers, function(cont) { return cont.id === container.id; });
          c.nativeId = instance.InstanceId;
          c.specific = newSpecific;
          system.dirty = true;
          cb(null, system);
        });
      });
    });
  }
860891
function(files, callback) {
            if (files.dest) {
                options['output'] = files.dest;
            }

			var commandLine = compcOptions.toCommandLine(options);

            if (files.src && files.src.length > 0) {                
                commandLine.push('-include-sources');
                commandLine.push.apply(commandLine, files.src);
                commandLine.push('--');
            }
            
			grunt.verbose.writeln('compc path: ' + binary);
			grunt.verbose.writeln('options: ' + commandLine);
		
			childProcess.execFile(binary, commandLine, function(error, stdout, stderr) {
                grunt.verbose.writeln('output: ' + stdout);
                
				if (error) {
					grunt.log.error(error.toString());
                    
                    if (options.force !== true) {
                        grunt.fail.warn('Compc task has failed.');
                    }                    
				}
                else if (files.dest) {
                    grunt.log.writeln('Build complete: ' + files.dest);
                }
                
                callback(error);
			});
		}
804625
public void createContainer(String container) {

        ContainerController controller = this.platformContainers.get(container);
        if (controller == null) {

            // TODO make this configurable
            Profile p = new ProfileImpl();
            p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);
            p.setParameter(Profile.MAIN_HOST, MAIN_HOST);
            p.setParameter(Profile.MAIN_PORT, MAIN_PORT);
            p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);
            int port = Integer.parseInt(MAIN_PORT);
            port = port + 1 + this.platformContainers.size();
            p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));
            p.setParameter(Profile.CONTAINER_NAME, container);
            logger.fine("Creating container " + container + "...");
            ContainerController agentContainer = this.runtime
                    .createAgentContainer(p);
            this.platformContainers.put(container, agentContainer);
            logger.fine("Container " + container + " created successfully.");
        } else {
            logger.fine("Container " + container + " is already created.");
        }

    }
1240902
def cargo_target_path(target, *path_components)
      target_base = ENV.fetch('CARGO_TARGET_DIR', File.join(rust_toplevel_dir, 'target'))
      File.join(target_base, target, *path_components)
    end
528556
function(dockcontainer, cb) {
          var opts = confImage && confImage.options && confImage.options.start
              || {};
          grunt.log.writeln("Starting container.");
          dockcontainer.start(opts, cb);
        }