Output environment name.
427886
def execute(self):
        """"""
        # Disable other runway logging so the only response is the env name
        logging.getLogger('runway').setLevel(logging.ERROR)

        # This may be invoked from a module directory in an environment;
        # account for that here if necessary
        if not os.path.isfile('runway.yml'):
            self.env_root = os.path.dirname(os.getcwd())
            self.runway_config_path = os.path.join(self.env_root, 'runway.yml')

        print(get_env(
            self.env_root,
            self.runway_config.get('ignore_git_branch', False)
        ))
568079
def environment_names
      yaml_environments =
        Dir[File.join(environments_path, '*.yaml')] \
          .map { |f| File.basename(f, '.yaml').to_s.strip.downcase }

      rb_environments =
        [].map { |f| File.basename(f, '.rb').to_s.strip.downcase }

      duplicate_environments = yaml_environments & rb_environments
      duplicate_environments.each do |dup_env_name|
        warn_log "environment '#{dup_env_name}' found in both YAML and Ruby; skipping."
      end

      (yaml_environments + rb_environments - duplicate_environments).sort
    end
1349444
private static String formatEnvironmentContext(Environment environment) {
    String environmentName = environment.getName();

    if (environmentName == null || environmentName.isEmpty()) {
      return "";
    } else {
      return environmentName.endsWith("_") ? environmentName : environmentName + "_";
    }
  }
574253
def get_current_environ():
    """"""
    thread_local = AutomatedLoggingMiddleware.thread_local
    if hasattr(thread_local, 'request_uri'):
        request_uri = thread_local.request_uri
    else:
        request_uri = None

    if hasattr(thread_local, 'application'):
        application = thread_local.application
        application = Application.objects.get_or_create(name=application)[0]
    else:
        application = None

    if hasattr(thread_local, 'method'):
        method = thread_local.method
    else:
        method = None

    if hasattr(thread_local, 'status'):
        status = thread_local.status
    else:
        status = None

    return request_uri, application, method, status
70219
def get_env():
    
    if not __ENV__:
        env = os.environ["env"] if "env" in os.environ else "Dev"
        set_env(env)
    return __ENV__
593063
def log_env(self, level, env):
        """"""
        self.log(level, "ENVIRONMENT:")
        for k, v in env.items():
            self.log(level, "    {} = {}".format(k, pformat(v)))
582122
def disttar_suffix(env, sources):
        """"""

        env_dict = env.Dictionary()
        if env_dict.has_key("DISTTAR_FORMAT") and env_dict["DISTTAR_FORMAT"] in ["gz", "bz2"]:
                return ".tar." + env_dict["DISTTAR_FORMAT"]
        else:
                return ".tar"
1371334
def get_environment(id=None, name=None):
    
    data = get_environment_raw(id, name)
    if data:
        return utils.format_json(data)
1114952
def get_env_variable(var_name, default=None):
    """"""
    try:
        return os.environ[var_name]
    except KeyError:
        if default is not None:
            return default
        else:
            error_msg = 'The environment variable {} was missing, abort...'\
                        .format(var_name)
            raise EnvironmentError(error_msg)
301667
def get_environment(config, stage):
    """"""
    stage_data = get_stage_data(stage, config.get('stages', {}))
    if not stage_data:
        sys.exit(NO_STAGE_DATA.format(stage))
    try:
        return stage_data['environment']
    except KeyError:
        sys.exit(NO_ENV_IN_STAGE.format(stage))
414925
def parse_env(self, env=None, namespace=None):
        """"""
        env = env or os.environ
        results = {}
        if not namespace:
            namespace = self.prog
        namespace = namespace.upper()  # pylint: disable=no-member
        for option in self._options:
            env_var = option.kwargs.get('env')
            default_env = "%s_%s" % (namespace, option.name.upper())
            if env_var and env_var in env:
                value = env[env_var]
                results[option.dest] = option.type(value)
            elif default_env in env:
                value = env[default_env]
                results[option.dest] = option.type(value)

        return results
254633
def find_kernel_specs_for_envs(self):
        """"""
        data = self._get_env_data()
        return {name: data[name][0] for name in data}
583752
def get_output_var_names(self):
        
        # Return all the variables that aren't input variables
        all_vars = list(self.species_name_map.keys())
        output_vars = list(set(all_vars) - set(self.input_vars))
        # Re-map to outside var names if needed
        for idx, var in enumerate(output_vars):
            if self._map_in_out(var) is not None:
                output_vars[idx] = self._map_in_out(var)
        return output_vars
1197533
private static void dumpOutDebugInfo() {

        LOG.info("Dump debug output");
        Map<String, String> envs = System.getenv();
        for (Map.Entry<String, String> env : envs.entrySet()) {
            LOG.info("System env: key=" + env.getKey() + ", val=" + env.getValue());
            System.out.println("System env: key=" + env.getKey() + ", val="
                    + env.getValue());
        }

        BufferedReader buf = null;
        try {
            String lines = Shell.WINDOWS ? Shell.execCommand("cmd", "/c", "dir") :
                    Shell.execCommand("ls", "-al");
            buf = new BufferedReader(new StringReader(lines));
            String line = "";
            while ((line = buf.readLine()) != null) {
                LOG.info("System CWD content: " + line);
                System.out.println("System CWD content: " + line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            org.apache.hadoop.io.IOUtils.cleanup(LOG, buf);
        }
    }
1290790
def _settings_from_env(self):
        """"""
        return {attr: self._val_from_env(env, attr)
                for env, attr in const.ENV_TO_ATTR.items()
                if env in os.environ}
587023
def get_environments():
    """"""
    envs = []
    for root, subfolders, files in os.walk('environments'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('environments'):], filename[:-len('.json')])
                envs.append(get_environment(path))
    return sorted(envs, key=lambda x: x['name'])
161049
def get_stacker_env_file(path, environment, region):
    """"""
    for name in gen_stacker_env_files(environment, region):
        if os.path.isfile(os.path.join(path, name)):
            return name
    return "%s-%s.env" % (environment, region)