Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15577349
D13503.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13503.id.diff
View Options
diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
@@ -10,6 +10,7 @@
private $activeResource;
private $activeLease;
private $instance;
+ private $scopes = array();
abstract public function getType();
abstract public function getInterface(
@@ -617,10 +618,11 @@
DrydockResource $resource = null,
DrydockLease $lease = null) {
- if (($this->activeResource !== null) ||
- ($this->activeLease !== null)) {
- throw new Exception(pht('There is already an active resource or lease!'));
- }
+ $scope = array(
+ 'resource' => $resource,
+ 'lease' => $lease,
+ );
+ array_push($this->scopes, $scope);
$this->activeResource = $resource;
$this->activeLease = $lease;
@@ -629,8 +631,20 @@
}
public function popActiveScope() {
- $this->activeResource = null;
- $this->activeLease = null;
+ if (count($this->scopes) === 0) {
+ throw new Exception('Unable to pop active scope; no scopes active');
+ }
+
+ array_pop($this->scopes);
+
+ if (count($this->scopes) === 0) {
+ $this->activeResource = null;
+ $this->activeLease = null;
+ } else {
+ $current = last($this->scopes);
+ $this->activeResource = $current['resource'];
+ $this->activeLease = $current['lease'];
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 7, 1:34 PM (1 h, 31 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7653070
Default Alt Text
D13503.id.diff (1 KB)
Attached To
Mode
D13503: [drydock/core] Allow nested leasing and resource allocation
Attached
Detach File
Event Timeline
Log In to Comment