// Releases routes releases commands to their specific function.
192969
func Releases(argv []string) error {
	usage := `
Valid commands for releases:

releases:list        list an application's release history
releases:info        print information about a specific release
releases:rollback    return to a previous release

Use 'deis help [command]' to learn more.
`

	switch argv[0] {
	case "releases:list":
		return releasesList(argv)
	case "releases:info":
		return releasesInfo(argv)
	case "releases:rollback":
		return releasesRollback(argv)
	default:
		if printHelp(argv, usage) {
			return nil
		}

		if argv[0] == "releases" {
			argv[0] = "releases:list"
			return releasesList(argv)
		}

		PrintUsage()
		return nil
	}
}
283490
func Release(id uint16) error {
	if !pool.Insert(idpool.ID(id)) {
		return fmt.Errorf("Unable to release endpoint ID %d", id)
	}

	return nil
}
177157
func (d *Datapath) releaseFlow(context *pucontext.PUContext, report *policy.FlowPolicy, action *policy.FlowPolicy, tcpPacket *packet.Packet) {

	if err := d.appOrigConnectionTracker.Remove(tcpPacket.L4ReverseFlowHash()); err != nil {
		zap.L().Debug("Failed to clean cache appOrigConnectionTracker", zap.Error(err))
	}

	if err := d.sourcePortConnectionCache.Remove(tcpPacket.SourcePortHash(packet.PacketTypeNetwork)); err != nil {
		zap.L().Debug("Failed to clean cache sourcePortConnectionCache", zap.Error(err))
	}

	if err := d.conntrack.UpdateNetworkFlowMark(
		tcpPacket.SourceAddress(),
		tcpPacket.DestinationAddress(),
		tcpPacket.IPProto(),
		tcpPacket.SourcePort(),
		tcpPacket.DestPort(),
		constants.DefaultConnMark,
	); err != nil {
		zap.L().Error("Failed to update conntrack table",
			zap.String("app-conn", tcpPacket.L4ReverseFlowHash()),
			zap.Error(err))
	}

	d.reportReverseExternalServiceFlow(context, report, action, true, tcpPacket)
}
227214
func (s *PostgresStore) Release() error {
	// Skip encoding if the data is empty
	if len(s.data) == 0 {
		return nil
	}

	data, err := session.EncodeGob(s.data)
	if err != nil {
		return err
	}

	_, err = s.c.Exec("UPDATE session SET data=$1, expiry=$2 WHERE key=$3",
		data, time.Now().Unix(), s.sid)
	return err
}
89015
func (v *VirtualIPManager) Release(ipaddr, device string) error {
	logger := plog.WithFields(logrus.Fields{
		"ipaddress": ipaddr,
		"device":    device,
	})

	cmd := exec.Command("ip", "a", "del", ipaddr, "dev", device)
	output, err := cmd.CombinedOutput()
	if err != nil {
		logger.WithError(err).WithFields(logrus.Fields{
			"command": cmd,
			"output":  string(output),
		}).Debug("Could not remove virtual ip")
		return err
	}

	logger.Debug("Removed virtual ip")
	return nil
}
121099
func (t TreeWalkPool) Release(params listParams) (resultCh chan TreeWalkResult, endWalkCh chan struct{}) {
	t.lock.Lock()
	defer t.lock.Unlock()
	walks, ok := t.pool[params] // Pick the valid walks.
	if ok {
		if len(walks) > 0 {
			// Pop out the first valid walk entry.
			walk := walks[0]
			walks = walks[1:]
			if len(walks) > 0 {
				t.pool[params] = walks
			} else {
				delete(t.pool, params)
			}
			walk.endTimerCh <- struct{}{}
			return walk.resultCh, walk.endWalkCh
		}
	}
	// Release return nil if params not found.
	return nil, nil
}
873277
func mapReleaseChangelogs(r Release) map[string]struct{} {
	changelogs := make(map[string]struct{})
	for _, clog := range r.Changelogs() {
		changelogs[clog.String()] = struct{}{}
	}

	return changelogs
}
230232
func (s *RedisStore) Release() error {
	// Skip encoding if the data is empty
	if len(s.data) == 0 {
		return nil
	}

	data, err := session.EncodeGob(s.data)
	if err != nil {
		return err
	}

	return s.c.SetEx(s.prefix+s.sid, s.duration, string(data)).Err()
}
466777
func (c *ClientContext) Release() error {
	if c == nil {
		return nil
	}
	return c.sctxt.Release()
}
528093
func (l *HostIPListener) release(req IPRequest) {
	logger := plog.WithField("ipaddress", req.IPAddress)
	logger.Info("Releasing ip binding")
	if err := l.handler.ReleaseIP(req.IPAddress); err != nil {
		logger.WithError(err).Error("Could not release ip binding")
	}

	if err := DeleteIP(l.conn, req); err != nil {
		logger.WithError(err).Error("Could not delete ip node from zookeeper")
	}
}
522447
func (s *FilesystemSource) ReleaseFilesystems(ctx context.ProviderCallContext, volIds []string) ([]error, error) {
	s.MethodCall(s, "ReleaseFilesystems", ctx, volIds)
	if s.ReleaseFilesystemsFunc != nil {
		return s.ReleaseFilesystemsFunc(ctx, volIds)
	}
	return nil, errors.NotImplementedf("ReleaseFilesystems")
}
139117
func (h *Handle) Release() {
	nPtr := atomic.LoadPointer(&h.n)
	if nPtr != nil && atomic.CompareAndSwapPointer(&h.n, nPtr, nil) {
		n := (*Node)(nPtr)
		n.unrefLocked()
	}
}
1163826
func (c *Pool) Release(ctx Context) {
	ctx.EndRequest()
	c.pool.Put(ctx)
}
1197836
func releaseServer(w http.ResponseWriter, r *http.Request) {
	name, ok := mux.Vars(r)["name"]
	if !ok {
		http.Error(w, "name missing in URL path", http.StatusBadRequest)
		return
	}
	mx.Lock()
	defer mx.Unlock()
	server, ok := servers[name]
	if !ok {
		http.Error(w, "no such server", http.StatusNotFound)
		return
	}
	server.Reserved = false
	if err := json.NewEncoder(w).Encode(server); err != nil {
		log.Printf("[JSON Encoding Error] %s", err)
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
838491
func RemoveRoute(route SteplibRoute) error {
	routes, err := readRouteMap()
	if err != nil {
		return err
	}

	newRoutes := SteplibRoutes{}
	for _, aRoute := range routes {
		if aRoute.SteplibURI != route.SteplibURI {
			newRoutes = append(newRoutes, aRoute)
		}
	}
	return newRoutes.writeToFile()
}
800092
func (cert *Certificate) Releases(tx *sql.Tx) ([]*Release, error) {
	var releases []*Release

	rows, err := tx.Query("SELECT release FROM roots WHERE ski=? AND serial=?", cert.SKI, cert.Serial)
	if err != nil {
		return nil, err
	}

	for rows.Next() {
		rel := &Release{
			Bundle: "ca",
		}

		err = rows.Scan(&rel.Version)
		if err != nil {
			return nil, err
		}

		releases = append(releases, rel)
	}
	rows.Close()

	rows, err = tx.Query("SELECT release FROM intermediates WHERE ski=? AND serial=?", cert.SKI, cert.Serial)
	if err != nil {
		return nil, err
	}

	for rows.Next() {
		rel := &Release{
			Bundle: "int",
		}

		err = rows.Scan(&rel.Version)
		if err != nil {
			return nil, err
		}

		releases = append(releases, rel)
	}

	for _, rel := range releases {
		err = rel.Select(tx)
		if err != nil {
			return nil, err
		}
	}

	return releases, nil
}
637003
func (r *Range) Release(ip net.IP) error {
	ok, offset := r.contains(ip)
	if !ok {
		return nil
	}

	return r.alloc.Release(offset)
}