Problem/Motivation
Proposed resolution
Remaining tasks
Add these Rules/Components into code
Post git pull (rule)
{ "rules_post_git_pull" : {
"LABEL" : "Post git pull",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "hosting task" ],
"REQUIRES" : [ "rules", "aegir_rules" ],
"ON" : { "post_hosting_default_execute" : [] },
"IF" : [
{ "entity_is_of_type" : { "entity" : [ "task" ], "type" : "node" } },
{ "entity_is_of_bundle" : {
"entity" : [ "task" ],
"type" : "node",
"bundle" : { "value" : { "task" : "task" } }
}
},
{ "data_is" : { "data" : [ "task:task-type" ], "value" : "git-pull" } }
],
"DO" : [
{ "component_rules_registry_rebuild" : { "trigger_task" : [ "task" ] } }
]
}
}
Registry rebuild (component)
{ "rules_registry_rebuild" : {
"LABEL" : "Registry rebuild",
"PLUGIN" : "rule",
"OWNER" : "rules",
"TAGS" : [ "hosting task" ],
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "trigger_task" : { "label" : "Triggering task", "type" : "node" } },
"IF" : [
{ "entity_is_of_type" : { "entity" : [ "trigger-task" ], "type" : "node" } },
{ "entity_is_of_bundle" : {
"entity" : [ "trigger-task" ],
"type" : "node",
"bundle" : { "value" : { "task" : "task" } }
}
}
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "task",
"param_title" : "[trigger-task:title]",
"param_author" : [ "trigger-task:author" ]
},
"PROVIDE" : { "entity_created" : { "new_task" : "New task" } }
}
},
{ "data_set" : { "data" : [ "new-task:rid" ], "value" : [ "trigger-task:rid" ] } },
{ "data_set" : { "data" : [ "new-task:task-status" ], "value" : "0" } },
{ "data_set" : { "data" : [ "new-task:task-type" ], "value" : "rebuild_registry" } },
{ "entity_save" : { "data" : [ "new-task" ], "immediate" : "1" } }
]
}
}
Comments
Comment #2
clemens.tolboomTo create a Rules task action we need to know the arguments. As tasks are provided by modules best location is the module providing the Task.
Lets start with a simple task to get things going. Which events are eligible for creating that task? How do we get to it the Site node to run the task against?
Comment #3
helmo commentedwork in progress on https://git.drutch.nl/drupal-contrib/aegir_rules
Comment #4
clemens.tolboomMy idea was to create a task based on the current task done. So I need to test for the task type say 'git-pull' to run a new task 'registry rebuild' or 'features-revert-all'.
I learned tasks are nodes but the fields needed
are not entity fields so a condition on entity has field fails.
Should we implement hook_entity_info_alter or define a pseudo field or ..
The above does not work yet. Guess I'm doing something wrong :(
Comment #5
clemens.tolboomTo create a new task we need to set several pseudo fields
- task_type
- task_status
- task_arguments
As learned in #2730603-8: Implement hook_entity_property_info exposing these through entity API does not make them writable.
The new action could use for
- task_type hook_hosting_task to get a list of tasks (is that permissions based?)
- task_arguments call the form (ie hosting_task_clone_form) for the task specific fields (is that permissions based?)
I made #2730603: Implement hook_entity_property_info a parent as that needs fixed first.
Comment #6
clemens.tolboomAs task_arguments is an array stored into hosting_task_arguments as key-value
drush @hostmaster sql-query "select * from hosting_task_arguments"or even better to get values by type
I hope we could use the form hooks for the keys
Comment #7
clemens.tolboomComment #8
clemens.tolboomIn #2730603: Implement hook_entity_property_info we concluded we can create simple tasks. But how do we process arguments for ie the source site for a site sync or do a forced git pull
Comment #9
helmo commented