Vault wrapper around node's "fs" module
357298
function FileVault(name, logger) {
	this.name = name;
	this.archive = new Archive(this);  // archivist bindings

	this.allowExpire = true;
	this.path = undefined;
	this.logger = logger;
	this._timers = {};
}
1193432
def get_all
      raise yellow(
        "Vault prefix: '#{prefix}' does not exist, or doesn't contain any secrets to pull/check"\
        "\nEnsure mount is enabled and use `sanctum create`, and `sanctum push` to add secrets"
      ) if invalid_prefix?

      secrets_from_vault = Hash.new
      secrets_from_vault[prefix] = JSON(list_recursive(list_prefix).to_json)
      secrets_from_vault
    end
305678
def seed(vault_client, opt):
    """"""
    if opt.thaw_from:
        opt.secrets = tempfile.mkdtemp('aomi-thaw')
        auto_thaw(vault_client, opt)

    Context.load(get_secretfile(opt), opt) \
           .fetch(vault_client) \
           .sync(vault_client, opt)

    if opt.thaw_from:
        rmtree(opt.secrets)
440362
def path_pieces(vault_path):
    """"""
    path_bits = vault_path.split('/')
    path = '/'.join(path_bits[0:len(path_bits) - 1])
    key = path_bits[len(path_bits) - 1]
    return path, key
374446
def loads(self, s):
        
        f = io.BytesIO(s)
        return VaultUnpickler(self, f).load()
169305
async function initRepo({
  repository,
  endpoint,
  gitPrivateKey,
  gitFs,
  localDir,
}) {
  logger.debug(
    `initRepo("${JSON.stringify(
      { repository, endpoint, gitFs, localDir },
      null,
      2
    )}")`
  );
  const opts = hostRules.find({ platform }, { endpoint });
  // istanbul ignore if
  if (!(opts.username && opts.password)) {
    throw new Error(
      `No username/password found for Bitbucket repository ${repository}`
    );
  }
  // istanbul ignore if
  if (!opts.endpoint) {
    throw new Error(`No endpoint found for Bitbucket Server`);
  }
  hostRules.update({ ...opts, platform, default: true });
  api.reset();

  const [projectKey, repositorySlug] = repository.split('/');
  config = { projectKey, repositorySlug, gitPrivateKey };

  // Always gitFs
  const { host, pathname } = url.parse(opts.endpoint);
  const gitUrl = GitStorage.getUrl({
    gitFs: gitFs || 'https',
    auth: `${opts.username}:${opts.password}`,
    host: `${host}${pathname}${pathname.endsWith('/') ? '' : '/'}scm`,
    repository,
  });

  config.storage = new GitStorage();
  await config.storage.initRepo({
    ...config,
    localDir,
    url: gitUrl,
  });

  const platformConfig = {};

  try {
    const info = (await api.get(
      `./rest/api/1.0/projects/${config.projectKey}/repos/${
        config.repositorySlug
      }`
    )).body;
    platformConfig.privateRepo = info.is_private;
    platformConfig.isFork = !!info.parent;
    platformConfig.repoFullName = info.name;
    config.owner = info.project.key;
    logger.debug(`${repository} owner = ${config.owner}`);
    config.defaultBranch = (await api.get(
      `./rest/api/1.0/projects/${config.projectKey}/repos/${
        config.repositorySlug
      }/branches/default`
    )).body.displayId;
    config.baseBranch = config.defaultBranch;
    config.mergeMethod = 'merge';
  } catch (err) /* istanbul ignore next */ {
    logger.debug(err);
    if (err.statusCode === 404) {
      throw new Error('not-found');
    }
    logger.info({ err }, 'Unknown Bitbucket initRepo error');
    throw err;
  }
  delete config.prList;
  delete config.fileList;
  logger.debug(
    { platformConfig },
    `platformConfig for ${config.projectKey}/${config.repositorySlug}`
  );
  return platformConfig;
}
1202278
function RedisVault(name, logger) {
	// required exposed properties

	this.name = name;                  // the unique vault name
	this.archive = new Archive(this);  // archivist bindings

	this.client = null;                // node-redis instance
	this.logger = logger;
}
1059219
def optional_actions(encrypt, path, compress_file, **kwargs):
    '''
    
    '''
    yes = ('y', 'Y')
    file_to_upload = normalize_path(path) + compress_file[1]
    if encrypt in yes:
        encrypt_file(compress_file[1], compress_file[0])
        file_to_upload = compress_file[0]

    if kwargs.get('s3') in yes:
        factory_uploader('S3', name_backup=file_to_upload,
                         bucket_name=AWS_BUCKET_NAME, action='upload')

    if kwargs.get('glacier') in yes:
        factory_uploader('Glacier', name_backup=file_to_upload,
                         vault_name=AWS_VAULT_NAME,
                         path=os.path.join(os.path.expanduser('~'),
                                           '.zoort.db'),
                         action='upload')
    if kwargs.get('dropbox') in yes:
        factory_uploader('Dropbox', name_backup=file_to_upload,
                         action='upload')
    if kwargs.get('swift') in yes:
        factory_uploader('Swift', name_backup=file_to_upload,
                         action='upload')
763388
function(req, res, next) {
        async.parallel({
            applications: (fn) => {
                const spy = { stash: {} };
                applications.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting applications.'));
                    }

                    return fn(null, spy.stash.body);
                });
            },
            hosts: (fn) => {
                const spy = { stash: {} };
                hosts.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting hosts.'));
                    }

                    return fn(null, spy.stash.body);
                });
            }
        }, (err, results) => {
            if(err) {
                res.stash.code = 500;
                return next();
            }

            res.stash.body = {
                applications: results.applications,
                hosts: results.hosts
            };
            res.stash.code = 200;
            return next();
        });
    }
73941
def get_vault_form(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinAdminSession.get_bin_form_for_update_template
        # This method might be a bit sketchy. Time will tell.
        if isinstance(args[-1], list) or 'vault_record_types' in kwargs:
            return self.get_vault_form_for_create(*args, **kwargs)
        else:
            return self.get_vault_form_for_update(*args, **kwargs)
386650
function bundleHandler (pathToHandlers, module, file) {

    // only rebundle if js file changed
    if (file.length < 3 || file.indexOf('bundle.') === 0 || file.substr(file.length - 3) !== '.js') {
        return;
    }

    // only rebundle if handler was already bundled before
    fs.access(pathToHandlers + '/bundle.' + file, err => {

        if (err && err.code === 'ENOENT') {
            return ;
        }

        let fnIri = module + '/' + file.slice(0, -3);

        // remove the old bundle
        fs.unlink(pathToHandlers + '/bundle.' + file, err => {

            if (err) {
                console.log('Failed to delete old bundle for handler: ' + fnIri);
                return console.log(err);
            }

            // build the new bundle
            console.log('Bundle handler: ' + fnIri);
            runtime.bundle(fnIri, {}, (err) => {

                if (err) {
                    console.log('Failed to bundle handler: ' + fnIri);
                    return console.log(err);
                }

                console.log('Bundle done for handler: ' + fnIri);
            });
        });
    });
}
58457
def secretfile_args(parser):
    """"""
    parser.add_argument('--secrets',
                        dest='secrets',
                        help='Path where secrets are stored',
                        default=os.path.join(os.getcwd(), ".secrets"))
    parser.add_argument('--policies',
                        dest='policies',
                        help='Path where policies are stored',
                        default=os.path.join(os.getcwd(), "vault", ""))
    parser.add_argument('--secretfile',
                        dest='secretfile',
                        help='Secretfile to use',
                        default=os.path.join(os.getcwd(), "Secretfile"))
    parser.add_argument('--tags',
                        dest='tags',
                        help='Tags of things to seed',
                        default=[],
                        type=str,
                        action='append')
    parser.add_argument('--include',
                        dest='include',
                        help='Specify paths to include',
                        default=[],
                        type=str,
                        action='append')
    parser.add_argument('--exclude',
                        dest='exclude',
                        help='Specify paths to exclude',
                        default=[],
                        type=str,
                        action='append')
921054
def vault_file(env, default):
    
    home = os.environ['HOME'] if 'HOME' in os.environ else \
        os.environ['USERPROFILE']
    filename = os.environ.get(env, os.path.join(home, default))
    filename = abspath(filename)
    if os.path.exists(filename):
        return filename

    return None
301628
def get_backend(backend, path, backends):
    """"""
    m_norm = normalize_vault_path(path)
    for mount_name, values in backends.items():
        b_norm = normalize_vault_path(mount_name)
        if (m_norm == b_norm) and values['type'] == backend:
            return values

    return None
289552
function hotDownloadUpdateChunk(chunkId) {
		var filename = require("path").join(__dirname, $hotChunkFilename$);
		require("fs").readFile(filename, "utf-8", function(err, content) {
			if (err) {
				if ($require$.onError) return $require$.oe(err);
				throw err;
			}
			var chunk = {};
			require("vm").runInThisContext(
				"(function(exports) {" + content + "\n})",
				{ filename: filename }
			)(chunk);
			hotAddUpdateChunk(chunk.id, chunk.modules);
		});
	}
1173983
def ext_pillar(minion_id,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               conf,
               nesting_key=None):
    '''
    
    '''
    comps = conf.split()

    paths = [comp for comp in comps if comp.startswith('path=')]
    if not paths:
        log.error('"%s" is not a valid Vault ext_pillar config', conf)
        return {}

    vault_pillar = {}

    try:
        path = paths[0].replace('path=', '')
        path = path.format(**{'minion': minion_id})
        url = 'v1/{0}'.format(path)
        response = __utils__['vault.make_request']('GET', url)
        if response.status_code == 200:
            vault_pillar = response.json().get('data', {})
        else:
            log.info('Vault secret not found for: %s', path)
    except KeyError:
        log.error('No such path in Vault: %s', path)

    if nesting_key:
        vault_pillar = {nesting_key: vault_pillar}
    return vault_pillar
1337847
def prune(self, vault_client):
        
        existing = getattr(vault_client,
                           SecretBackend.list_fun)()['data'].items()
        for mount_name, _values in existing:
            # ignore system paths and cubbyhole
            mount_path = normalize_vault_path(mount_name)
            if mount_path.startswith('sys') or mount_path == 'cubbyhole':
                continue

            exists = [resource.path
                      for resource in self.mounts()
                      if normalize_vault_path(resource.path) == mount_path]

            if not exists:
                LOG.info("removed unknown mount %s", mount_path)
                getattr(vault_client, SecretBackend.unmount_fun)(mount_path)