Skip to content

Instantly share code, notes, and snippets.

@gabrielhurley
Created July 24, 2012 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielhurley/3167094 to your computer and use it in GitHub Desktop.
Save gabrielhurley/3167094 to your computer and use it in GitHub Desktop.
Project Workflows Add Project ID
diff --git a/horizon/dashboards/syspanel/projects/views.py b/horizon/dashboards/syspanel/projects/views.py
index e5f2f54..ec3a6e6 100644
--- a/horizon/dashboards/syspanel/projects/views.py
+++ b/horizon/dashboards/syspanel/projects/views.py
@@ -182,7 +182,7 @@ class UpdateProjectView(workflows.WorkflowView):
initial = super(UpdateProjectView, self).get_initial()
project_id = self.kwargs['tenant_id']
- initial['id'] = project_id
+ initial['project_id'] = project_id
try:
# get initial project info
diff --git a/horizon/dashboards/syspanel/projects/workflows.py b/horizon/dashboards/syspanel/projects/workflows.py
index 119dffd..3071400 100644
--- a/horizon/dashboards/syspanel/projects/workflows.py
+++ b/horizon/dashboards/syspanel/projects/workflows.py
@@ -49,6 +49,7 @@ class UpdateProjectQuotaAction(workflows.Action):
class UpdateProjectQuota(workflows.Step):
action_class = UpdateProjectQuotaAction
+ depends_on = ("project_id",)
contributes = ("metadata_items",
"cores",
"instances",
@@ -139,6 +140,7 @@ class UpdateProjectInfoAction(CreateProjectInfoAction):
class UpdateProjectInfo(workflows.Step):
action_class = UpdateProjectInfoAction
+ depends_on = ("project_id",)
contributes = ("name",
"description",
"enabled")
@@ -159,14 +161,10 @@ class UpdateProject(workflows.Workflow):
def handle(self, request, data):
- url = request.path
- id_start = url.rpartition('projects/')[2]
- project_id = id_start.rpartition('/update')[0]
-
# update project info
try:
api.tenant_update(request,
- tenant_id=project_id,
+ tenant_id=data['project_id'],
tenant_name=data['name'],
description=data['description'],
enabled=data['enabled'])
@@ -178,7 +176,7 @@ class UpdateProject(workflows.Workflow):
ifcb = data['injected_file_content_bytes']
try:
api.tenant_quota_update(request,
- project_id,
+ data['project_id'],
metadata_items=data['metadata_items'],
injected_file_content_bytes=ifcb,
volumes=data['volumes'],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment