Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(20)

Delta Between Two Patch Sets: state/unit.go

Issue 6498117: container: fix jujud arguments.
Left Patch Set: container: fix jujud arguments. Created 12 years, 7 months ago
Right Patch Set: container: fix jujud arguments. Created 12 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « mstate/unit_test.go ('k') | state/unit_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 package state 1 package state
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 "fmt" 5 "fmt"
6 "launchpad.net/goyaml" 6 "launchpad.net/goyaml"
7 "launchpad.net/gozk/zookeeper" 7 "launchpad.net/gozk/zookeeper"
8 "launchpad.net/juju-core/charm" 8 "launchpad.net/juju-core/charm"
9 "launchpad.net/juju-core/state/presence" 9 "launchpad.net/juju-core/state/presence"
10 "launchpad.net/juju-core/trivial" 10 "launchpad.net/juju-core/trivial"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // See OpenPorts for details. 474 // See OpenPorts for details.
475 func (u *Unit) WatchPorts() *PortsWatcher { 475 func (u *Unit) WatchPorts() *PortsWatcher {
476 return newPortsWatcher(u.st, u.zkPortsPath()) 476 return newPortsWatcher(u.st, u.zkPortsPath())
477 } 477 }
478 478
479 // AgentAlive returns whether the respective remote agent is alive. 479 // AgentAlive returns whether the respective remote agent is alive.
480 func (u *Unit) AgentAlive() (bool, error) { 480 func (u *Unit) AgentAlive() (bool, error) {
481 return presence.Alive(u.st.zk, u.zkAgentPath()) 481 return presence.Alive(u.st.zk, u.zkAgentPath())
482 } 482 }
483 483
484 // AgentName returns the name used to identify the unit's agent. 484 // PathKey returns a name identifying the unit that can be used as a
485 func (u *Unit) AgentName() string { 485 // file name. The returned key will be different from other
486 » return fmt.Sprintf("unit-%s-%d", u.serviceName, keySeq(u.key)) 486 // PathKeys returned by any other entities from the same state.
487 func (u *Unit) PathKey() string {
488 » return "unit-" + strings.Replace(u.Name(), "/", "-", -1)
487 } 489 }
488 490
489 // WaitAgentAlive blocks until the respective agent is alive. 491 // WaitAgentAlive blocks until the respective agent is alive.
490 func (u *Unit) WaitAgentAlive(timeout time.Duration) error { 492 func (u *Unit) WaitAgentAlive(timeout time.Duration) error {
491 err := presence.WaitAlive(u.st.zk, u.zkAgentPath(), timeout) 493 err := presence.WaitAlive(u.st.zk, u.zkAgentPath(), timeout)
492 if err != nil { 494 if err != nil {
493 return fmt.Errorf("waiting for agent of unit %q: %v", u, err) 495 return fmt.Errorf("waiting for agent of unit %q: %v", u, err)
494 } 496 }
495 return nil 497 return nil
496 } 498 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // valid mode if acceptNone is true. 563 // valid mode if acceptNone is true.
562 func validResolvedMode(mode ResolvedMode, acceptNone bool) error { 564 func validResolvedMode(mode ResolvedMode, acceptNone bool) error {
563 if acceptNone && mode == ResolvedNone { 565 if acceptNone && mode == ResolvedNone {
564 return nil 566 return nil
565 } 567 }
566 if mode != ResolvedRetryHooks && mode != ResolvedNoHooks { 568 if mode != ResolvedRetryHooks && mode != ResolvedNoHooks {
567 return fmt.Errorf("invalid error resolution mode: %d", mode) 569 return fmt.Errorf("invalid error resolution mode: %d", mode)
568 } 570 }
569 return nil 571 return nil
570 } 572 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b