Index: deploy.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/deploy.install,v
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.3 deploy.install
--- deploy.install	10 Dec 2009 04:38:18 -0000	1.1.4.3
+++ deploy.install	14 Apr 2010 07:30:00 -0000
@@ -117,10 +117,10 @@ function deploy_schema() {
         'length' => 100,
         'not null' => TRUE,
       ),
-      'api_key' => array(
-        'description' => t('The Services API key to be used when submitting items to the remote server.'),
+      'auth_type' => array(
+        'description' => t('The authentication type this server is using.'),
         'type' => 'varchar',
-        'length' => 32,
+        'length' => 100,
         'not null' => TRUE,
       ),
     ),
@@ -262,7 +262,12 @@ function deploy_update_6002() {
 function deploy_update_6003() {
   $update = array();
   
+  db_add_field($update, 'deploy_servers', 'auth_type', array('type' => 'varchar', 'length' => 100, 'not null' > TRUE));
   db_drop_field($update, 'deploy_servers', 'api_key');
 
+  // Also update all existing servers to use session ids (the only choice
+  // possible previously).  
+  db_query("update {deploy_servers} set auth_type = 'deploy_sessid'");
+
   return $update;
 }
Index: deploy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/deploy.module,v
retrieving revision 1.2.2.6
diff -u -p -r1.2.2.6 deploy.module
--- deploy.module	10 Mar 2010 22:38:36 -0000	1.2.2.6
+++ deploy.module	14 Apr 2010 07:30:00 -0000
@@ -164,6 +164,13 @@ function deploy_menu() {
     'weight' => 1,
   );
 
+  // Server form AHAH callback.
+  $items['admin/build/deploy/ahah/auth-form'] = array(
+    'page callback' => 'deploy_ahah_auth_form',
+    'access arguments' => array('administer deployment'),
+    'type' => MENU_CALLBACK,
+  );
+
   // Deployment logs
   $items['admin/build/deploy/logs'] = array(
     'title' => 'Deployment Log',
@@ -199,7 +206,7 @@ function deploy_menu() {
     'title' => 'Push a plan live',
     'description' => 'Push a plan live',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('deploy_pushform'),
+    'page arguments' => array('deploy_plan_push_form'),
     'access arguments' => array('deploy items'),
     'type' => MENU_CALLBACK,
   );
@@ -322,47 +329,43 @@ function deploy_add_to_plan($pid, $modul
  * Prompts the user to choose what server they wish to deploy to before
  * proceeding with the good stuff.
  *
- * @param $form_state
- *   FAPI form state
  * @param $pid
  *   Unique identifier of the plan we're pushing.
+ * @param $sid
+ *   Which server to use for the deployment.
  * @return
  *   FAPI form definition
  * @ingroup forms
- * @see deploy_pushform_submit()
+ * @see deploy_plan_push_form_submit()
  */
-function deploy_pushform($form_state, $pid) {
+function deploy_plan_push_form($pid, $sid = NULL) {
   $form = deploy_get_server_form();
-  
+
   $form['pid'] = array(
     '#type' => 'hidden',
     '#value' => $pid,
   );
-  
+
   return $form;
 }
 
 /**
- * Submit callback for deploy_pushform()
+ * Submit callback for deploy_plan_push_form()
  *
  * This is where the actual action takes place.
  *
  * @todo Check system config on remote host - installed modules, proper versions, etc.
  * @todo Better error message handling that is not dependent on xmlrpc_error.
  */
-function deploy_pushform_submit($form, &$form_state) {
+function deploy_plan_push_form_submit($form, &$form_state) {
   // Setup some data
   global $user;
   $pid = $form_state['values']['pid'];
   $sid = $form_state['values']['sid'];
-  $username = $form_state['values']['username'];
-  $password = $form_state['values']['password'];
-
-  deploy_init_deployment($pid, $sid);
 
   // If a session is successfully created, then go on to the deploy_check
   // batch process. Otherwise quit out and show the error log.
-  if (deploy_set_session($username, $password)) {
+  if (deploy_plan_init($pid, $sid, $form_state['values'])) {
     $form_state['redirect'] = "admin/build/deploy/deploy_check_batch";
   }
   else {
@@ -604,17 +607,12 @@ function deploy_get_min_weight($pid) {
  *   Results of the remote call.
  */
 function deploy_send($protocol_args, $function_args) {
-  // In the end $protocol_args needs to be URL of XMLRPC endpoint, function name, session ID.
-  // The one exception to this is system.connect, which never requires a session id (it is the
-  // equivalent of your first page hit to a drupal site, establishing an anonymous session.)
-  $url = variable_get('deploy_server_url', '');
-  if ($protocol_args[0] == 'system.connect') {
-    $protocol_args = array($url, $protocol_args[0]);
-  }
-  else {
-    $sessid = variable_get('deploy_sessid', '');
-    $protocol_args = array($url, $protocol_args[0], $sessid);
-  }
+  // Get the active server.
+  $server = variable_get('deploy_server', array());
+
+  array_unshift($protocol_args, $server['url']);
+  deploy_auth_invoke($server['auth_type'], 'arguments callback', $protocol_args, $function_args);
+
   return call_user_func_array('xmlrpc', array_merge($protocol_args, $function_args));
 }
 
@@ -670,18 +668,29 @@ function deploy_delete_plan($pid) {
   db_query("DELETE FROM {deploy_plan} WHERE pid = %d", $pid);
 }
 
-function deploy_init_deployment($pid, $sid) {
+/**
+ * Initiate depolyment.
+ *
+ * @param $pid
+ *   ID of the plan to deploy.
+ * @param $sid
+ *   ID of the server to deploy to.
+ * @param $settings
+ *   Server settings that was posted from the server form.
+ */
+function deploy_plan_init($pid, $sid, $settings = array()) {
   include_once('./includes/xmlrpc.inc');
 
   global $user;
 
   $plan = deploy_get_plan($pid);
   $server = deploy_get_server($sid);
-  $url = $server['url'];
+  // Also add settings that came from the submitted server form.
+  $server['settings'] = $settings;
 
   // Save this data out so the other modules can get it. Not sure of a better
   // way to handle this.
-  variable_set('deploy_server_url', $url);
+  variable_set('deploy_server', $server);
   variable_set('deploy_pid', $pid);
 
   // This used to be a static within deploy_item(), but batch API breaks
@@ -693,36 +702,11 @@ function deploy_init_deployment($pid, $s
   // associated data gets deleted.
   db_query("INSERT INTO {deploy_log} (plan, server, username, ts) VALUES ('%s', '%s', '%s', %d)", $plan['name'], $server['description'], $user->name, time());
   variable_set('deploy_log_id', db_last_insert_id('deploy_log', 'dlid'));
+  return deploy_auth_invoke($server['auth_type'], 'init callback', $server);
 }
 
 
 /**
- * Setup a user session for deployment.
- */
-function deploy_set_session($username, $password) {
-  // In order to prevent bots from cluttering up the sessions table, you must
-  // have an active anonymous session before logging in to Drupal. So that is
-  // the first thing we do with system.connect. This session ID is saved
-  // to the 'deploy_sessid' variable, which all other xmlrpc calls to the
-  // remote server passes.
-  $result = deploy_send(array('system.connect'), array());
-  variable_set('deploy_sessid', $result['sessid']);
-
-  // Then we can log in.
-  $result = deploy_send(array('user.login'), array($username, $password));
-
-  // If it fails, then add a message to the log. Otherwise set the session ID into
-  // a drupal variable for the other functions to grab.
-  if ($result === FALSE) {
-    db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", variable_get('deploy_log_id', ''), 'login', 'Remote user login', 'Error', xmlrpc_error_msg());
-  }
-  else {
-    variable_set('deploy_sessid', $result['sessid']);
-    return TRUE;
-  }
-}
-
-/**
  * Run the dependency checking hooks for the specified deployment plan.
  *
  * @param $pid
@@ -820,9 +804,11 @@ function deploy_plan_cleanup() {
   // clear remote cache
   deploy_send(array('system.cacheClearAll'), array());
   
-  variable_del('deploy_server_url');
+  $server = variable_get('deploy_server', '');
+  deploy_auth_invoke($server['auth_type'], 'cleanup callback');
+
+  variable_del('deploy_server');
   variable_del('deploy_pid');
-  variable_del('deploy_sessid');
   variable_del('deploy_log_id');
   variable_del('deploy_fatal');
 }
@@ -849,7 +835,7 @@ function deploy_get_remote_key($uuid, $m
 }
 
 /**
- * Standard form with server list, username, and password. Used in many places.
+ * Standard form with server list. Used in many places.
  */
 function deploy_get_server_form() {
   $servers = deploy_get_servers();
@@ -857,38 +843,76 @@ function deploy_get_server_form() {
     drupal_set_message(t("There are no servers defined. Please define a server using the Servers tab before pushing your deployment plan."));
     drupal_goto("admin/build/deploy");
   }
-  
+  // Rebuild the server list so we also have an empty option.
+  $options = array('' => t('-- Select a server'));
+  foreach ($servers as $sid => $server) {
+    $options[$sid] = $server;
+  }
+
   $form['sid'] = array(
     '#title' => t('Server'),
     '#type' => 'select',
-    '#options' => $servers,
-    '#description' => t('The server you want to deploy to'),
+    '#options' => $options,
+    '#description' => t('Select the server you want to deploy to'),
+    '#required' => TRUE,
+    '#ahah' => array(
+      'path' => 'admin/build/deploy/ahah/auth-form',
+      'wrapper' => 'deploy-auth-wrapper',
+      'method' => 'replace',
+    ),
   );
-  $form['username'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Username'),
-    '#size' => 30,
-    '#maxlength' => 60,
-    '#default_value' => variable_get('deploy_remote_username', ''),
-    '#description' => t('Username for the remote user Deploy should log in as.'),
+
+  $form['auth_wrapper'] = array(
+    '#prefix' => '<div id="deploy-auth-wrapper">',
+    '#suffix' => '</div>',
   );
-  $form['password'] = array(
-    '#type' => 'password',
-    '#title' => t('Password'),
-    '#size' => 20,
-    '#maxlength' => 32,
-    '#default_value' => variable_get('deploy_remote_password', ''),
-    '#description' => t('Password of the remote user Deploy should log in as.'),
+
+  // This form element will be replaced with the response from an AHAH request.
+  $form['auth_wrapper']['settings'] = array(
+    '#type' => 'hidden',
   );
+
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Push Deployment Plan'),
   );
-  
+
   return $form;
 }
 
 /**
+ * A generic AHAH form callback that returns the authentication form for a
+ * server or a authentication type.
+ */
+function deploy_ahah_auth_form() {
+  $cached_form_state = array();
+  $cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state);
+  $server = isset($_POST['sid']) ? deploy_get_server($_POST['sid']) : array();
+
+  if (isset($_POST['auth_type'])) {
+    $auth_type = $_POST['auth_type'];
+  }
+  elseif (isset($server['auth_type'])) {
+    $auth_type = $server['auth_type'];
+  }
+
+  $settings = deploy_auth_invoke($auth_type, 'form callback', $server);
+  $cached_form['auth_wrapper']['settings'] = $settings;
+  form_set_cache($_POST['form_build_id'], $cached_form, $cached_form_state);
+  $form_state = array('submitted' => FALSE);
+  $options = form_builder('deploy_ahah_auth_form', $cached_form['auth_wrapper'], $form_state);
+  $output = drupal_render($options);
+
+  print drupal_to_js(
+    array(
+      'status' => TRUE,
+      'data' => $output,
+    )
+  );
+  exit;
+}
+
+/**
  * Implementation of hook_views_api().
  */
 function deploy_views_api() {
@@ -896,4 +920,219 @@ function deploy_views_api() {
     'api' => 2,
     'path' => drupal_get_path('module', 'deploy') . '/includes',
   );
-}
\ No newline at end of file
+}
+
+/**
+ * Invokes an authentication callback.
+ */
+function deploy_auth_invoke($type_name, $callback_type, &$a1 = NULL, &$a2 = NULL, &$a3 = NULL) {
+  $type = deploy_get_auth_type($type_name);
+
+  if (!isset($type[$callback_type]) || $type[$callback_type] === TRUE) {
+    return TRUE;
+  }
+  else {
+    $function = $type[$callback_type];
+    return $function($a1, $a2, $a3);
+  }
+}
+
+/**
+ * Get all the available authentication types.
+ *
+ * @return
+ *   An associative array of the authentication type definitions.
+ */
+function deploy_get_auth_types() {
+  static $types = array();
+
+  if (!empty($types)) {
+    return $types;
+  }
+
+  $auth_modules = module_implements('deploy_auth_info');
+  foreach ($auth_modules as $module) {
+    $items = module_invoke($module, 'deploy_auth_info');
+    // Add the machine readable name to the item it self.
+    foreach ($items as $name => $item) {
+      $item['name'] = $name;
+      $types[$name] = $item;
+    }
+  }
+  // Let other modules alter all authentication types.
+  drupal_alter('deploy_auth_type', $types);
+  return $types;
+}
+
+/**
+ * Get a specific authentication type.
+ *
+ * @param $name
+ *   The name of the type to get.
+ * @return
+ *   The authentication type definition.
+ */
+function deploy_get_auth_type($name) {
+  $types = deploy_get_auth_types();
+  return $types[$name];
+}
+
+/**
+ * Returns a hash to be used with the key authentication.
+ *
+ * @param $key
+ *   The API key to be used in the hash.
+ * @param $timestamp
+ *    The timestamp to be used in the hash.
+ * @param $domain
+ *   The domain to be used in the hash.
+ * @param $nonce
+ *   The nonce to be used in the hash.
+ * @param $method
+ *   The method to be used in the hash.
+ * @todo
+ *   Add signed arguments.
+ */
+function deploy_get_auth_key_hash($key, $timestamp, $domain, $nonce, $method) {
+  $hash_parameters = array($timestamp, $domain, $nonce, $method);
+  return hash_hmac('sha256', implode(';', $hash_parameters), $key);
+}
+
+/**
+ * Implementation of hook_deploy_auth_info().
+ *
+ * This hook implements support for the two basic authentication types
+ * that comes with the Services module by default. Those are authentication
+ * with just a valid session id, or authentication with just an API key.
+ *
+ * Session authentication (with username and password) does only make
+ * sense when deploying against another Drupal sites (which isn't always the
+ * case).
+ *
+ * @return
+ *   An array of this modules' authentication types.
+ * @todo
+ *   Make it so callbacks can be stored in a separate file.
+ */
+function deploy_deploy_auth_info() {
+  $items['deploy_key'] = array(
+    'title' => t('Key authentication'),
+    'description' => t('All method calls must include a valid token to authenticate themselves with the server.'),
+    'form callback' => 'deploy_auth_key_form',
+    'arguments callback' => 'deploy_auth_key_arguments',
+  );
+  $items['deploy_sessid'] = array(
+    'title' => t('Session id'),
+    'description' => t('All method calls must include a valid session id.'),
+    'form callback' => 'deploy_auth_sessid_form',
+    'init callback' => 'deploy_auth_sessid_init',
+    'arguments callback' => 'deploy_auth_sessid_arguments',
+    'cleanup callback' => 'deploy_auth_sessid_cleanup',
+  );
+
+  return $items;
+}
+
+/**
+ * Implementation of the init callback.
+ */
+function deploy_auth_sessid_init($server = array()) {
+  // In order to prevent bots from cluttering up the sessions table, you must
+  // have an active anonymous session before logging in to Drupal. So that is
+  // the first thing we do with system.connect. This session ID is saved
+  // to the 'deploy_sessid' variable, which all other xmlrpc calls to the
+  // remote server passes.
+  $result = deploy_send(array('system.connect'), array());
+  variable_set('deploy_auth_sessid', $result['sessid']);
+
+  // Then we can log in.
+  $result = deploy_send(array('user.login'), array($server['settings']['username'], $server['settings']['password']));
+
+  // If it fails, then add a message to the log. Otherwise set the session ID into
+  // a drupal variable for the other functions to grab.
+  if ($result === FALSE) {
+    db_query("INSERT INTO {deploy_log_details} (dlid, module, description, result, message) VALUES (%d, '%s', '%s', '%s', '%s')", variable_get('deploy_log_id', ''), 'login', 'Remote user login', 'Error', xmlrpc_error_msg());
+  }
+  else {
+    variable_set('deploy_auth_sessid', $result['sessid']);
+    return TRUE;
+  }
+}
+
+/**
+ * Implementation of the arguments callback.
+ */
+function deploy_auth_key_arguments(&$protocol_args, &$function_args) {
+  // Get the active server.
+  $server = variable_get('deploy_server', array());
+
+  $timestamp = time();
+  $method = $protocol_args[1];
+  // Use Drupal's built in password generator to generate a random string.
+  $nonce = user_password();
+
+  $hash = deploy_get_auth_key_hash($server['settings']['key'], $timestamp, $server['settings']['domain'], $nonce, $method);
+  array_push($protocol_args, $hash, $server['settings']['domain'], $timestamp, $nonce);
+}
+
+/**
+ * Implementation of the arguments callback.
+ */
+function deploy_auth_sessid_arguments(&$protocol_args, &$function_args) {
+  // Check the method name. The server URL is the first argument.
+  if ($protocol_args[1] != 'system.connect') {
+    $sessid = variable_get('deploy_auth_sessid', '');
+    array_push($protocol_args, $sessid);
+  }
+}
+
+/**
+ * Implementation of the cleanup callback.
+ */
+function deploy_auth_sessid_cleanup() {
+  variable_del('deploy_auth_sessid');
+}
+
+/**
+* Implementation of the form callback for the authentication.
+*/
+function deploy_auth_key_form($server = array()) {
+  $form['key'] = array(
+    '#type' => 'textfield',
+    '#title' => t('API key'),
+    '#description' => t('The API key to use when authenticating with the remote server.'),
+    '#required' => TRUE,
+  );
+  $form['domain'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Domain'),
+    '#description' => t('Domain using this key (note this is not necessarily the same as your domain name).'),
+    '#required' => TRUE,
+ );
+
+ return $form;
+}
+
+/**
+ * Implementation of the form callback for the authentication.
+ */
+function deploy_auth_sessid_form($server = array()) {
+  $form['username'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Username'),
+    '#size' => 30,
+    '#maxlength' => 60,
+    '#description' => t('Username on the remote site.'),
+    '#required' => TRUE,
+  );
+  $form['password'] = array(
+    '#type' => 'password',
+    '#title' => t('Password'),
+    '#size' => 20,
+    '#maxlength' => 32,
+    '#description' => t('Password of the remote user Deploy should log in as.'),
+    '#required' => TRUE,
+  );
+
+  return $form;
+}
Index: deploy.servers.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/Attic/deploy.servers.admin.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 deploy.servers.admin.inc
--- deploy.servers.admin.inc	20 Mar 2009 14:49:40 -0000	1.1.2.2
+++ deploy.servers.admin.inc	14 Apr 2010 07:30:00 -0000
@@ -12,11 +12,12 @@
  *   Themed table output.
  */
 function deploy_server_overview() {
-  $header = array(t('Name'), t('URL'), array('data' => t('Operations'), 'colspan' => 2));
+  $header = array(t('Name'), t('URL'), t('Authentication type'), array('data' => t('Operations'), 'colspan' => 2));
 
   $result = db_query("SELECT * FROM {deploy_servers}");
   while ($row = db_fetch_array($result)) {
-    $row = array(check_plain($row['description']), check_plain($row['url']), l(t('edit'), 'admin/build/deploy/server/'. $row['sid']), l(t('delete'), 'admin/build/deploy/delete/server/'. $row['sid']));
+    $auth_type = deploy_get_auth_type($row['auth_type']);
+    $row = array(check_plain($row['description']), check_plain($row['url']), $auth_type['title'], l(t('edit'), 'admin/build/deploy/server/'. $row['sid']), l(t('delete'), 'admin/build/deploy/delete/server/'. $row['sid']));
     $rows[] = $row;
   }
 
@@ -48,7 +49,7 @@ function deploy_server_form($form_state,
   $server = NULL;
 
   // If we got a SID, get the plan's details.
-  if (!is_null($sid)) {
+  if (!empty($sid)) {
     $server = deploy_get_server($sid);
     $form['sid'] = array(
       '#type' => 'hidden',
@@ -74,6 +75,22 @@ function deploy_server_form($form_state,
     '#default_value' => $server['url'],
     '#description' => t('Domain name and path to xmlrpc service.'),
   );
+
+  $auth_options = array('' => t('-- Select a type'));
+  $auth_types = deploy_get_auth_types();
+  foreach ($auth_types as $key => $type) {
+    $auth_options[$key] = $type['title'];
+  }
+
+  $form['auth_type'] = array(
+    '#title' => t('Authentication type'),
+    '#description' => t('Select which authentication type to be used when deploying to this specific server.'),
+    '#type' => 'select',
+    '#required' => TRUE,
+    '#options' => $auth_options,
+    '#default_value' => $server['auth_type'],
+  );
+
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save Deployment Server'),
@@ -88,16 +105,17 @@ function deploy_server_form($form_state,
 function deploy_server_form_submit($form, &$form_state) {
   $url = $form_state['values']['url'];
   $description = $form_state['values']['description'];
+  $auth_type = $form_state['values']['auth_type'];
 
   // If 'sid' exists in the submitted form, then this is an edit. Otherwise it is
   // a new server.
   if (array_key_exists('sid', $form_state['values'])) {
     $sid = $form_state['values']['sid'];
-    db_query("UPDATE {deploy_servers} SET description = '%s', url = '%s' WHERE sid = %d", $description, $url, $sid);
+    db_query("UPDATE {deploy_servers} SET description = '%s', url = '%s', auth_type = '%s' WHERE sid = %d", $description, $url, $auth_type, $sid);
     drupal_set_message(t('Deployment server updated'));
   }
   else {
-    db_query("INSERT INTO {deploy_servers} (description, url) VALUES ('%s', '%s')", $description, $url);
+    db_query("INSERT INTO {deploy_servers} (description, url, auth_type) VALUES ('%s', '%s', '%s')", $description, $url, $auth_type);
     drupal_set_message(t('Deployment server added'));
   }
 
Index: modules/comment_deploy/comment_deploy.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/modules/comment_deploy/Attic/comment_deploy.pages.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 comment_deploy.pages.inc
--- modules/comment_deploy/comment_deploy.pages.inc	20 Jun 2009 04:44:14 -0000	1.1.2.1
+++ modules/comment_deploy/comment_deploy.pages.inc	14 Apr 2010 07:30:00 -0000
@@ -101,8 +101,6 @@ function comment_deploy_operations_add_n
  */
 function comment_deploy_operations_add_now_form_submit($form, &$form_state) {
   $sid = $form_state['values']['sid'];
-  $username = $form_state['values']['username'];
-  $password = $form_state['values']['password'];
 
   // If there is already a plan for these comments, then empty it and use it.
   // Otherwise create one. Every deployment needs to be attached to a plan, so
@@ -124,8 +122,7 @@ function comment_deploy_operations_add_n
   }
 
   // Now do the deployment
-  deploy_init_deployment($pid, $sid);
-  if (deploy_set_session($username, $password)) {
+  if (deploy_plan_init($pid, $sid, $form_state['values'])) {
     // Redirect to the log overview page for this push.
     $form_state['redirect'] = "admin/build/deploy/deploy_check_batch";
   }
@@ -134,6 +131,6 @@ function comment_deploy_operations_add_n
     deploy_plan_cleanup();
 
     // Redirect to the log overview page for this push.
-    $form_state['redirect'] = "/admin/build/deploy/logs/details/$dlid";    
+    $form_state['redirect'] = "admin/build/deploy/logs/details/$dlid";    
   }
 }
Index: modules/node_deploy/node_deploy.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/modules/node_deploy/Attic/node_deploy.pages.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 node_deploy.pages.inc
--- modules/node_deploy/node_deploy.pages.inc	3 Aug 2009 03:55:22 -0000	1.1.2.2
+++ modules/node_deploy/node_deploy.pages.inc	14 Apr 2010 07:30:00 -0000
@@ -153,10 +153,27 @@ function node_deploy_operations_add_now_
  */
 function node_deploy_operations_add_now_form_submit($form, &$form_state) {
   $sid = $form_state['values']['sid'];
-  $username = $form_state['values']['username'];
-  $password = $form_state['values']['password'];
+  $pid = node_deploy_operations_create_plan($form_state['values']['nids']);
 
-  // If there is already aplan for this vocabulary, then empty it and use it.
+  // Now do the deployment
+  if (deploy_plan_init($pid, $sid, $form_state['values'])) {
+    // Redirect to the log overview page for this push.
+    $form_state['redirect'] = "admin/build/deploy/deploy_check_batch";
+  }
+  else {
+    $dlid = variable_get('deploy_log_id', '');
+    deploy_plan_cleanup();
+
+    // Redirect to the log overview page for this push.
+    $form_state['redirect'] = "admin/build/deploy/logs/details/$dlid";    
+  }
+}
+
+/**
+ * Helper function that creates a deployment plan.
+ */
+function node_deploy_operations_create_plan($nids) {
+  // If there is already a plan for this, then empty it and use it.
   // Otherwise create one.
   $pid = deploy_plan_exists('Nodes Now');
   if (!$pid) {
@@ -166,24 +183,11 @@ function node_deploy_operations_add_now_
     deploy_empty_plan($pid);
   }
 
-  $result = db_query("SELECT nid, title, type FROM {node} WHERE nid IN (%s)", $form_state['values']['nids']);
+  $result = db_query("SELECT nid, title, type FROM {node} WHERE nid IN (%s)", $nids);
   while ($row = db_fetch_array($result)) {
     if (!deploy_item_is_in_plan($pid, 'node', $row['nid'])) {
       deploy_add_to_plan($pid, 'node', $row['type'] .': '. $row['title'], $row['nid'], 0, DEPLOY_NODE_GROUP_WEIGHT);
     }
   }
-
-  // Now do the deployment
-  deploy_init_deployment($pid, $sid);
-  if (deploy_set_session($username, $password)) {
-    // Redirect to the log overview page for this push.
-    $form_state['redirect'] = "admin/build/deploy/deploy_check_batch";
-  }
-  else {
-    $dlid = variable_get('deploy_log_id', '');
-    deploy_plan_cleanup();
-
-    // Redirect to the log overview page for this push.
-    $form_state['redirect'] = "admin/build/deploy/logs/details/$dlid";    
-  }
-}
+  return $pid;
+}
\ No newline at end of file
Index: modules/taxonomy_deploy/taxonomy_deploy.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/deploy/modules/taxonomy_deploy/Attic/taxonomy_deploy.pages.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 taxonomy_deploy.pages.inc
--- modules/taxonomy_deploy/taxonomy_deploy.pages.inc	30 Mar 2009 20:14:37 -0000	1.1.2.1
+++ modules/taxonomy_deploy/taxonomy_deploy.pages.inc	14 Apr 2010 07:30:00 -0000
@@ -39,8 +39,6 @@ function taxonomy_vocabulary_deploy_add_
 function taxonomy_vocabulary_deploy_add_form_submit($form, &$form_state) {
   $sid = $form_state['values']['sid'];
   $vid = $form_state['values']['vid'];
-  $username = $form_state['values']['username'];
-  $password = $form_state['values']['password'];
   
   // If there is already aplan for this vocabulary, then empty it and use it.
   // Otherwise create one.
@@ -51,9 +49,8 @@ function taxonomy_vocabulary_deploy_add_
   else {
     deploy_empty_plan($pid);
   }
-  
-  deploy_init_deployment($pid, $sid);
-  if (deploy_set_session($username, $password)) {
+
+  if (deploy_plan_init($pid, $sid, $form_state['values'])) {
     $result = db_query("SELECT tid, vid, name FROM {term_data} WHERE vid = %d", $vid);
     while ($term = db_fetch_array($result)) {
       deploy_add_to_plan($pid, 'taxonomy_term', $term['name'], $term['tid'], 0, DEPLOY_TAXONOMY_TERM_GROUP_WEIGHT);
@@ -66,4 +63,11 @@ function taxonomy_vocabulary_deploy_add_
     
     $form_state['redirect'] = "admin/build/deploy/deploy_push_batch/$pid";
   }
+  else {
+    $dlid = variable_get('deploy_log_id', '');
+    deploy_plan_cleanup();
+
+    // Redirect to the log overview page for this push.
+    $form_state['redirect'] = "admin/build/deploy/logs/details/$dlid";
+  }
 }
\ No newline at end of file
