Author: sandervanderburg
Date: Tue Jan 18 20:48:15 2011
New Revision: 25613
URL: https://svn.nixos.org/websvn/nix/?rev=25613&sc=1

Log:
Implemented --no-upgrade and --no-target-profiles options

Modified:
   disnix/disnix/trunk/doc/manual/disnix-activate.xml
   disnix/disnix/trunk/src/activate/activate.c
   disnix/disnix/trunk/src/activate/activate.h
   disnix/disnix/trunk/src/activate/main.c

Modified: disnix/disnix/trunk/doc/manual/disnix-activate.xml
==============================================================================
--- disnix/disnix/trunk/doc/manual/disnix-activate.xml  Tue Jan 18 17:54:26 
2011        (r25612)
+++ disnix/disnix/trunk/doc/manual/disnix-activate.xml  Tue Jan 18 20:48:15 
2011        (r25613)
@@ -91,6 +91,32 @@
                                </listitem>
                        </varlistentry>
                        <varlistentry>
+                               
<term><option>-no-coordinator-profile</option></term>
+                               <listitem>
+                                       <para>
+                                               By enabling this option Disnix 
does not store the deployment state for further use, such as upgrading.
+                                       </para>
+                               </listitem>
+                       </varlistentry>
+                       <varlistentry>
+                               
<term><option>--no-target-profiles</option></term>
+                               <listitem>
+                                       <para>
+                                               By enabling this option Disnix 
does not create profiles on the target machines containing the
+                                               services.
+                                       </para>
+                               </listitem>
+                       </varlistentry>
+                       <varlistentry>
+                               <term><option>--no-upgrade</option></term>
+                               <listitem>
+                                       <para>
+                                               By enabling this option Disnix 
will not perform an upgrade, but only activates services in the
+                                               new configuration.
+                                       </para>
+                               </listitem>
+                       </varlistentry>
+                       <varlistentry>
                                <term><option>-h</option>, 
<option>--help</option></term>
                                <listitem>
                                        <para>

Modified: disnix/disnix/trunk/src/activate/activate.c
==============================================================================
--- disnix/disnix/trunk/src/activate/activate.c Tue Jan 18 17:54:26 2011        
(r25612)
+++ disnix/disnix/trunk/src/activate/activate.c Tue Jan 18 20:48:15 2011        
(r25613)
@@ -31,7 +31,7 @@
 #include <activationmapping.h>
 #include <targets.h>
 
-int activate_system(gchar *interface, gchar *new_manifest, gchar 
*old_manifest, gchar *coordinator_profile_path, gchar *profile, gboolean 
no_coordinator_profile)
+int activate_system(gchar *interface, gchar *new_manifest, gchar 
*old_manifest, gchar *coordinator_profile_path, gchar *profile, gboolean 
no_coordinator_profile, gboolean no_target_profiles, gboolean no_upgrade)
 {
     gchar *old_manifest_file;
     GArray *old_activation_mappings;
@@ -82,7 +82,7 @@
            old_manifest_file = g_strdup(old_manifest);
 
        /* If we have an old configuration -> open it */
-       if(old_manifest_file != NULL)
+       if(!no_upgrade && old_manifest_file != NULL)
        {                   
            g_print("Using previous manifest: %s\n", old_manifest_file);
            old_activation_mappings = 
create_activation_array(old_manifest_file);
@@ -94,7 +94,6 @@
            old_activation_mappings = NULL;
 
        /* Try to acquire a lock */
-    
        status = lock(interface, distribution_array, profile);
     
        if(status == 0)
@@ -103,11 +102,14 @@
            status = transition(interface, new_activation_mappings, 
old_activation_mappings, target_array);
        
            if(status == 0)
-           {               
-               /* Set the new profiles on the target machines */
-               g_print("Setting the new profiles on the target machines:\n");
-               status = set_target_profiles(distribution_array, interface, 
profile);
-           
+           {
+               if(!no_target_profiles)
+               {
+                   /* Set the new profiles on the target machines */
+                   g_print("Setting the new profiles on the target 
machines:\n");
+                   status = set_target_profiles(distribution_array, interface, 
profile);
+               }
+               
                /* Try to release the lock */
                unlock(interface, distribution_array, profile);
            

Modified: disnix/disnix/trunk/src/activate/activate.h
==============================================================================
--- disnix/disnix/trunk/src/activate/activate.h Tue Jan 18 17:54:26 2011        
(r25612)
+++ disnix/disnix/trunk/src/activate/activate.h Tue Jan 18 20:48:15 2011        
(r25613)
@@ -36,8 +36,10 @@
  * @param coordinator_profile_path Path where the current deployment state is 
stored for future reference
  * @param profile Name of the distributed profile
  * @param no_coordinator_profile Do not create a coordinator profile
+ * @param no_target_profiles Do not create Disnix profiles on the target 
machines
+ * @param no_upgrade Force Disnix to not look at the previous configuration
  * @return 0 if the process suceeds, else a non-zero exit value
  */
-int activate_system(gchar *interface, gchar *new_manifest, gchar 
*old_manifest, gchar *coordinator_profile_path, gchar *profile, gboolean 
no_coordinator_profile);
+int activate_system(gchar *interface, gchar *new_manifest, gchar 
*old_manifest, gchar *coordinator_profile_path, gchar *profile, gboolean 
no_coordinator_profile, gboolean no_target_profiles, gboolean no_upgrade);
 
 #endif

Modified: disnix/disnix/trunk/src/activate/main.c
==============================================================================
--- disnix/disnix/trunk/src/activate/main.c     Tue Jan 18 17:54:26 2011        
(r25612)
+++ disnix/disnix/trunk/src/activate/main.c     Tue Jan 18 20:48:15 2011        
(r25613)
@@ -34,6 +34,7 @@
     fprintf(stderr, "--old-manifest manifest\n");
     fprintf(stderr, "--target-property targetProperty\n");
     fprintf(stderr, "--no-coordinator-profile\n");
+    fprintf(stderr, "--no-target-profiles\n");
     fprintf(stderr, "\n");
     
     fprintf(stderr, "%s {-h | --help}\n", command);
@@ -50,6 +51,8 @@
        {"coordinator-profile-path", required_argument, 0, 'P'},
        {"profile", required_argument, 0, 'p'},
        {"no-coordinator-profile", no_argument, 0, 'c'},
+       {"no-target-profiles", no_argument, 0, 'C'},
+       {"no-upgrade", no_argument, 0, 'u'},
        {"help", no_argument, 0, 'h'},
        {0, 0, 0, 0}
     };
@@ -58,6 +61,8 @@
     char *profile = NULL;
     char *coordinator_profile_path = NULL;
     int no_coordinator_profile = FALSE;
+    int no_target_profiles = FALSE;
+    int no_upgrade = FALSE;
     
     /* Parse command-line options */
     while((c = getopt_long(argc, argv, "o:p:h", long_options, &option_index)) 
!= -1)
@@ -79,6 +84,12 @@
            case 'c':
                no_coordinator_profile = TRUE;
                break;
+           case 'C':
+               no_target_profiles = TRUE;
+               break;
+           case 'u':
+               no_upgrade = TRUE;
+               break;
            case 'h':
                print_usage(argv[0]);
                return 0;
@@ -96,5 +107,5 @@
        return 1;
     }
     else
-       return activate_system(interface, argv[optind], old_manifest, 
coordinator_profile_path, profile, no_coordinator_profile); /* Execute 
activation operation */
+       return activate_system(interface, argv[optind], old_manifest, 
coordinator_profile_path, profile, no_coordinator_profile, no_target_profiles, 
no_upgrade); /* Execute activation operation */
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to