// PodName returns the name of the pod as specified in either the
// the source or destination arguments
963922
func (o *RsyncOptions) PodName() string {
	if len(o.Source.PodName) > 0 {
		return o.Source.PodName
	}
	return o.Destination.PodName
}
653403
func (e *loginProvision) deviceName(m libkb.MetaContext) (string, error) {
	var names []string
	upk, _, err := m.G().GetUPAKLoader().LoadV2(libkb.NewLoadUserArgWithMetaContext(m).WithUID(e.arg.User.GetUID()).WithPublicKeyOptional().WithForcePoll(true).WithSelf(true))
	if err != nil {
		m.Debug("error getting device names via upak: %s", err)
		m.Debug("proceeding to ask user for a device name despite error...")
	} else {
		names = upk.AllDeviceNames()
	}

	// Fully non-interactive flow
	if e.arg.DeviceName != "" {
		return e.automatedDeviceName(m, names, e.arg.DeviceName)
	}

	arg := keybase1.PromptNewDeviceNameArg{
		ExistingDevices: names,
	}

	for i := 0; i < 10; i++ {
		devname, err := m.UIs().ProvisionUI.PromptNewDeviceName(m.Ctx(), arg)
		if err != nil {
			return "", err
		}
		if !libkb.CheckDeviceName.F(devname) {
			m.Debug("invalid device name supplied: %s", devname)
			arg.ErrorMessage = "Invalid device name. Device names should be " + libkb.CheckDeviceName.Hint
			continue
		}
		devname = libkb.CheckDeviceName.Transform(devname)
		var dupname string
		normalizedDevName := libkb.CheckDeviceName.Normalize(devname)
		for _, name := range names {
			if normalizedDevName == libkb.CheckDeviceName.Normalize(name) {
				dupname = name
				break
			}
		}

		if dupname != "" {
			m.Debug("Device name reused: %q == %q", devname, dupname)
			var dupnameErrMsg string
			// if we have a collision on the normalized values add some extra
			// info the error message so the user isn't confused why we
			// consider the names equal.
			if devname != dupname {
				dupnameErrMsg = fmt.Sprintf(" as %q", dupname)
			}
			arg.ErrorMessage = fmt.Sprintf("The device name %q is already taken%s. You can't reuse device names, even revoked ones, for security reasons. Otherwise, someone who stole one of your devices could cause a lot of confusion.", devname, dupnameErrMsg)
			continue
		}

		return devname, nil
	}
	return "", libkb.RetryExhaustedError{}
}
1306859
func (r *marathonClient) PodByVersion(name, version string) (*Pod, error) {
	uri := fmt.Sprintf("%s/%s", buildPodVersionURI(name), version)
	result := new(Pod)
	if err := r.apiGet(uri, nil, result); err != nil {
		return nil, err
	}

	return result, nil
}
705783
func (d *Helper) DeletePod(pod corev1.Pod) error {
	return d.Client.CoreV1().Pods(pod.Namespace).Delete(pod.Name, d.makeDeleteOptions())
}
1132159
func (p *AttachOptions) GetContainerName(pod *api.Pod) string {
	return p.GetContainer(pod).Name
}
307801
func (m *Mount) Source(podRoot string) string {
	switch m.Volume.Kind {
	case "host":
		return m.Volume.Source
	case "empty":
		return filepath.Join(common.SharedVolumesPath(podRoot), m.Volume.Name.String())
	}
	return "" // We validate in GenerateMounts that it's valid
}
609517
func (p *Pod) AppNameToImageName(appName types.ACName) types.ACIdentifier {
	image, ok := p.Images[appName.String()]
	if !ok {
		// This should be impossible as we have updated the map in LoadPod().
		panic(fmt.Sprintf("No images for app %q", appName.String()))
	}
	return image.Name
}
642453
func (m *cgroupManagerImpl) Name(name CgroupName) string {
	if m.adapter.cgroupManagerType == libcontainerSystemd {
		return name.ToSystemd()
	}
	return name.ToCgroupfs()
}
952762
func ValidatePodPresetName(name string, prefix bool) []string {
	// TODO: Validate that there's name for the suffix inserted by the pods.
	// Currently this is just "-index". In the future we may allow a user
	// specified list of suffixes and we need  to validate the longest one.
	return apimachineryvalidation.NameIsDNSSubdomain(name, prefix)
}
1059201
func generatePodName(name string, nodeName types.NodeName) string {
	return fmt.Sprintf("%s-%s", name, strings.ToLower(string(nodeName)))
}
21279
func osName() string {
	name, err := syscall.Sysctl("kern.ostype")
	if err != nil {
		return runtime.GOOS
	}
	return name
}
666916
func HostName() (string, error) {
	buf, err := exec.Command("hostname").Output()
	if err != nil {
		return "", err
	}
	if buf[len(buf)-1] == 10 {
		buf = buf[:len(buf)-1]
	}
	return string(buf), nil
}
597587
func (t *Track) Name() string {
	return C.GoString(C.sp_track_name(t.sp_track))
}
1137262
func (r *marathonClient) Pod(name string) (*Pod, error) {
	uri := buildPodURI(name)
	result := new(Pod)
	if err := r.apiGet(uri, nil, result); err != nil {
		return nil, err
	}

	return result, nil
}
522224
func MyHostname() string {
	myHostnameOnce.Do(func() {
		var err error
		myHostname, err = os.Hostname()
		if err != nil {
			log.Fatal(err)
		}
	})
	return myHostname
}
440274
func ParsePodFullName(podFullName string) (string, string, error) {
	parts := strings.Split(podFullName, "_")
	if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
		return "", "", fmt.Errorf("failed to parse the pod full name %q", podFullName)
	}
	return parts[0], parts[1], nil
}
751215
func getParentName(pod *v1.Pod) string {
	parent, _ := getParentNameAndOrdinal(pod)
	return parent
}