Gets the current deployment for a target.

@param env       the target's environment
@param siteName  the target's site name

@return the pending and current deployments for the target

@throws DeployerException if an error occurred
513418
@RequestMapping(value = GET_CURRENT_DEPLOYMENT_URL, method = RequestMethod.GET)
    public ResponseEntity<Deployment> getCurrentDeployment(@PathVariable(ENV_PATH_VAR_NAME) String env,
                                                           @PathVariable(SITE_NAME_PATH_VAR_NAME) String siteName)
        throws DeployerException {
        Target target = targetService.getTarget(env, siteName);
        Deployment deployment = target.getCurrentDeployment();

        return new ResponseEntity<>(deployment,
                                    RestServiceUtils.setLocationHeader(new HttpHeaders(), BASE_URL + GET_CURRENT_DEPLOYMENT_URL,
                                                                       env, siteName),
                                    HttpStatus.OK);
    }
15413
ExecutionEngine initializeEE()
    {
        String hostname = CoreUtils.getHostnameOrAddress();
        HashinatorConfig hashinatorConfig = TheHashinator.getCurrentConfig();
        ExecutionEngine eeTemp = null;
        Deployment deploy = m_context.cluster.getDeployment().get("deployment");
        final int defaultDrBufferSize = Integer.getInteger("DR_DEFAULT_BUFFER_SIZE", 512 * 1024); // 512KB
        int configuredTimeout = Integer.getInteger("MAX_EXPORT_BUFFER_FLUSH_INTERVAL", 4*1000);
        final int exportFlushTimeout = configuredTimeout > 0 ? configuredTimeout : 4*1000;
        int tempTableMaxSize = deploy.getSystemsettings().get("systemsettings").getTemptablemaxsize();
        if (System.getProperty("TEMP_TABLE_MAX_SIZE") != null) {
            // Allow a system property to override the deployment setting
            // for testing purposes.
            tempTableMaxSize = Integer.getInteger("TEMP_TABLE_MAX_SIZE");
        }

        try {
            // NATIVE_EE_JNI and NATIVE_EE_LARGE_JNI
            if (m_backend.isDefaultJNITarget) {
                eeTemp =
                    new ExecutionEngineJNI(
                        m_context.cluster.getRelativeIndex(),
                        m_siteId,
                        m_partitionId,
                        m_context.getNodeSettings().getLocalSitesCount(),
                        CoreUtils.getHostIdFromHSId(m_siteId),
                        hostname,
                        m_context.cluster.getDrclusterid(),
                        defaultDrBufferSize,
                        tempTableMaxSize,
                        hashinatorConfig,
                        m_isLowestSiteId,
                        exportFlushTimeout);
            }
            else if (m_backend == BackendTarget.NATIVE_EE_SPY_JNI){
                Class<?> spyClass = Class.forName("org.mockito.Mockito");
                Method spyMethod = spyClass.getDeclaredMethod("spy", Object.class);
                ExecutionEngine internalEE = new ExecutionEngineJNI(
                        m_context.cluster.getRelativeIndex(),
                        m_siteId,
                        m_partitionId,
                        m_context.getNodeSettings().getLocalSitesCount(),
                        CoreUtils.getHostIdFromHSId(m_siteId),
                        hostname,
                        m_context.cluster.getDrclusterid(),
                        defaultDrBufferSize,
                        tempTableMaxSize,
                        hashinatorConfig,
                        m_isLowestSiteId,
                        exportFlushTimeout);
                eeTemp = (ExecutionEngine) spyMethod.invoke(null, internalEE);
            }
            else if (m_backend.isIPC) {
                // set up the EE over IPC
                eeTemp =
                    new ExecutionEngineIPC(
                            m_context.cluster.getRelativeIndex(),
                            m_siteId,
                            m_partitionId,
                            m_context.getNodeSettings().getLocalSitesCount(),
                            CoreUtils.getHostIdFromHSId(m_siteId),
                            hostname,
                            m_context.cluster.getDrclusterid(),
                            defaultDrBufferSize,
                            tempTableMaxSize,
                            m_backend,
                            VoltDB.instance().getConfig().m_ipcPort,
                            hashinatorConfig,
                            m_isLowestSiteId,
                            exportFlushTimeout);
            }
            else {
                /* This seems very bad. */
                throw new VoltAbortException(
                        String.format("Unexpected BackendTarget value %s", m_backend)
                );
            }
            eeTemp.loadCatalog(m_startupConfig.m_timestamp, m_startupConfig.m_serializedCatalog);
            eeTemp.setBatchTimeout(m_context.cluster.getDeployment().get("deployment").
                            getSystemsettings().get("systemsettings").getQuerytimeout());
        }
        // just print error info an bail if we run into an error here
        catch (final Exception ex) {
            hostLog.l7dlog( Level.FATAL, LogKeys.host_ExecutionSite_FailedConstruction.name(),
                            new Object[] { m_siteId, m_siteIndex }, ex);
            VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex);
        }
        return eeTemp;
    }
925
public OvhEnvVar serviceName_envVar_key_GET(String serviceName, String key) throws IOException {
		String qPath = "/hosting/web/{serviceName}/envVar/{key}";
		StringBuilder sb = path(qPath, serviceName, key);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhEnvVar.class);
	}
1355627
@Override
    public String getName() {
        String name;
        if (getSoftwareSystem() != null) {
            name = getSoftwareSystem().getName() + " - Deployment";
        } else {
            name = "Deployment";
        }

        if (!StringUtils.isNullOrEmpty(getEnvironment())) {
            name = name + " - " + getEnvironment();
        }

        return name;
    }
142540
public static String getEnvVariable( String name )
        throws EnvironmentException
    {
        if( isUnix() )
        {
            Properties properties = getUnixShellVariables();
            return properties.getProperty( name );
        }
        else if( isWindows() )
        {
            Properties properties = getWindowsShellVariables();
            return properties.getProperty( name );
        }

        String osName = System.getProperty( "os.name" );
        throw new EnvironmentException( name, "Non-supported operating system: " + osName );
    }
1244570
public static String get() {
		String env = System.getProperty("JOGGER_ENV");
		if (env == null) {
			env = System.getenv("JOGGER_ENV");
		}

		if (env == null) {
			return "dev";
		}

		return env;
	}
959792
protected function _getEnvironment()
    {
        $environment = self::$forceEnvironment;

        // Check if the environment has been manually set (forced).
        if ($environment !== null) {
            if (!isset($this->_environments[$environment])) {
                throw new Exception('Environment configuration for "' . $environment . '" could not be found.');
            }
        }
        // If no manual setting is available, use "host:port" to decide which config to use.
        if ($environment === null && !empty($_SERVER['HTTP_HOST'])) {
            $host = (string)$_SERVER['HTTP_HOST'];
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['domain']) && in_array($host, $envConfig['domain'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // If there is no host:port match, try "host" only.
        if ($environment === null && !empty($_SERVER['SERVER_NAME'])) {
            $host = (string)$_SERVER['SERVER_NAME'];
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['domain']) && in_array($host, $envConfig['domain'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // If no host matched then try to use the APP path.
        if ($environment === null && ($serverPath = $this->_getRealAppPath())) {
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['path']) && in_array($serverPath, $envConfig['path'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // No environment could be identified -> we are on a dev machine.
        if (!$environment) {
            $environment = 'local';
        }

        return $environment;
    }
556997
public static SourceBuilder forEnvironment(ProcessingEnvironment env, FeatureSet features) {
    return new SourceBuilder(
        new CompilerReflection(env.getElementUtils()),
        Optional.ofNullable(features).orElseGet(() -> new EnvironmentFeatureSet(env)));
  }
61963
protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException {
        if(mi!=null) {
            // if somebody has use M2_HOME they will get a classloading error
            // when M2_HOME points to a different version of Maven2 from
            // MAVEN_HOME (as Maven 2 gives M2_HOME priority.)
            //
            // The other solution would be to set M2_HOME if we are calling Maven2
            // and MAVEN_HOME for Maven1 (only of use for strange people that
            // are calling Maven2 from Maven1)
            mi.buildEnvVars(env);
        }
        // just as a precaution
        // see http://maven.apache.org/continuum/faqs.html#how-does-continuum-detect-a-successful-build
        env.put("MAVEN_TERMINATE_CMD","on");

        String jvmOptions = env.expand(this.jvmOptions);
        if(jvmOptions!=null)
            env.put("MAVEN_OPTS",jvmOptions.replaceAll("[\t\r\n]+"," "));
    }
795702
private void setFromEnv() throws DevFailed {
        String env = TangoEnv.getTangoHost();
        assert env != null;
        if (!env.contains(":"))
            Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
                    "Unknown \"TANGO_HOST\" property " + env,
                    "TangoUrl.setFromEnv()");
        String[] array = ApiUtil.parseTangoHost(env);
        host = array[0];
        strPort = array[1];
        port = Integer.parseInt(strPort);
        envRead = true;
        fromEnv = true;
    }
612866
public function deploy(DNEnvironment $environment, $sha, DeploynautLogFile $log, DNProject $project, $leaveMaintenancePage = false) {
		$this->extend('deployStart', $environment, $sha, $log, $project);

		$file = sprintf('%s/%s.deploy-history.txt', DEPLOYNAUT_LOG_PATH, $environment->getFullName());
		$CLI_file = escapeshellarg($file);
		$CLI_line = escapeshellarg(date('Y-m-d H:i:s') . " => $sha");

		// Put maintenance page up
		$this->enableMaintenance($environment, $log, $project);

		// Do the deployment
		$log->write("Demo deployment: echo $CLI_line >> $CLI_file");
		`echo $CLI_line >> $CLI_file`;
		$log->write("Arbitrary pause for 10s");
		sleep(10);
		$log->write("Well, that was a waste of time");

		// Once the deployment has run it's necessary to update the maintenance page status
		if($leaveMaintenancePage) {
			$this->enableMaintenance($environment, $log, $project);
		} else {
			// Remove maintenance page if we want it to
			$this->disableMaintenance($environment, $log, $project);
		}

		$this->extend('deployEnd', $environment, $sha, $log, $project);
	}
509186
private void findDeploymentAddress(final String deploymentID, Handler<AsyncResult<String>> resultHandler) {
    context.execute(new Action<String>() {
      @Override
      public String perform() {
        synchronized (deployments) {
          JsonObject locatedInfo = null;
          Collection<String> sdeploymentsInfo = deployments.get(cluster);
          for (String sdeploymentInfo : sdeploymentsInfo) {
            JsonObject deploymentInfo = new JsonObject(sdeploymentInfo);
            if (deploymentInfo.getString("id").equals(deploymentID)) {
              locatedInfo = deploymentInfo;
              break;
            }
          }
          if (locatedInfo != null) {
            return locatedInfo.getString("address");
          }
          return null;
        }
      }
    }, resultHandler);
  }
202219
public static String getEnv(){
        if(ENV == null){
            if(!blank(System.getenv("ACTIVE_ENV"))) {
                ENV = System.getenv("ACTIVE_ENV");
            }

            if(!blank(System.getProperty("ACTIVE_ENV"))) {
                ENV = System.getProperty("ACTIVE_ENV");
            }

            if(!blank(System.getProperty("active_env"))) {
                ENV = System.getProperty("active_env");
            }

            if(blank(ENV)){                
                ENV = "development";
                LOGGER.warn("Environment variable ACTIVE_ENV not provided, defaulting to '" + ENV + "'");
            }
        }
        return ENV;
    }
430793
def deploy_sitesettings():
    
    
    sitesettings = '/'.join([deployment_root(),'env',env.project_fullname,'project',env.project_package_name,'sitesettings'])
    local_dir = os.path.join(os.getcwd(),env.project_package_name,'sitesettings')
 
    created = deploy_files(local_dir, sitesettings)
    if env.verbosity and created:
        print env.host,"DEPLOYING sitesettings"
        for path in created:
            tail = path.split('/')[-1]
            print ' * uploaded',tail
198695
public function deployerActivity()
    {
        $configs = JsonListener::open(FEnv::get("framework.config.core.config.file"));

        return ($this->render("deployermanager", array("selected" => "deployermanager",
            "default_env" => $configs->default_env, "loader_msg" => "Deployer Manager")));
    }
855218
public T get(Env env) throws APIException {
		Thread t = Thread.currentThread();
		T obj = objs.get(t);
		if(obj==null || refreshed>obj.created()) {
			try {
				obj = cnst.newInstance(new Object[]{env});
			} catch (InvocationTargetException e) {
				throw new APIException(e.getTargetException());
			} catch (Exception e) {
				throw new APIException(e);
			}
			T destroyMe = objs.put(t,obj);
			if(destroyMe!=null) {
				destroyMe.destroy(env);
			}
		} 
		return obj;
	}
636544
private static Map<String, String> getConfServerBasePathMap(String app, String version, String env, String key) {

        Map<String, String> parameterMap = new LinkedHashMap<String, String>();

        parameterMap.put(Constants.VERSION, version);
        parameterMap.put(Constants.APP, app);
        parameterMap.put(Constants.ENV, env);
        parameterMap.put(Constants.KEY, key);

        return parameterMap;
    }