Ejemplo n.º 1
0
int capture_manifest(gchar *interface, const gchar *target_property, gchar *infrastructure_expr, gchar *profile, const unsigned int max_concurrent_transfers)
{
    /* Retrieve an array of all target machines from the infrastructure expression */
    GPtrArray *target_array = create_target_array(infrastructure_expr);

    if(target_array == NULL)
    {
        g_printerr("[coordinator]: Error retrieving targets from infrastructure model!\n");
        return 1;
    }
    else
    {
        GPtrArray *profile_manifest_target_array = g_ptr_array_new();
        int exit_status;
        
        if(resolve_profiles(target_array, interface, target_property, profile, profile_manifest_target_array)
          && retrieve_profiles(interface, profile_manifest_target_array, max_concurrent_transfers))
        {
            print_nix_expression_for_profile_manifest_target_array(profile_manifest_target_array);
            exit_status = 0;
        }
        else
            exit_status = 1;
        
        /* Cleanup */
        delete_profile_manifest_target_array(profile_manifest_target_array);
        delete_target_array(target_array);
        
        /* Return exit status */
        return exit_status;
    }
}
Ejemplo n.º 2
0
int query_installed(gchar *interface, const gchar *target_property, gchar *infrastructure_expr, gchar *profile, OutputFormat format)
{
    /* Retrieve an array of all target machines from the infrastructure expression */
    GPtrArray *target_array = create_target_array(infrastructure_expr);

    if(target_array == NULL)
    {
        g_printerr("[coordinator]: Error retrieving targets from infrastructure model!\n");
        return 1;
    }
    else
    {
        int success;

        /* Iterate over targets and capture their installed services */
        GPtrArray *profile_manifest_target_array = g_ptr_array_new();
        QueryInstalledServicesData data = { profile, profile_manifest_target_array };
        ProcReact_FutureIterator iterator = create_target_future_iterator(target_array, target_property, interface, query_installed_services_on_target, complete_query_installed_services_on_target, &data);
        procreact_fork_in_parallel_buffer_and_wait(&iterator);
        success = target_iterator_has_succeeded(iterator.data);
        
        /* Print the captured configurations */
        print_installed_services(&data, format);
        
        /* Cleanup */
        destroy_target_future_iterator(&iterator);
        delete_profile_manifest_target_array(profile_manifest_target_array);
        delete_target_array(target_array);
        
        /* Return exit status */
        return (!success);
    }
}
Ejemplo n.º 3
0
int clean_snapshots(gchar *interface, const gchar *target_property, gchar *infrastructure_expr, int keep, gchar *container, gchar *component)
{
    /* Retrieve an array of all target machines from the infrastructure expression */
    GPtrArray *target_array = create_target_array(infrastructure_expr);

    if(target_array == NULL)
    {
        g_printerr("[coordinator]: Error retrieving targets from infrastructure model!\n");
        return 1;
    }
    else
    {
        /* Iterate over all targets and run clean snapshots operation in parallel */
        int success;
        CleanSnapshotsData data = { keep, container, component };
        ProcReact_PidIterator iterator = create_target_pid_iterator(target_array, target_property, interface, clean_snapshots_on_target, complete_clean_snapshots_on_target, &data);

        procreact_fork_in_parallel_and_wait(&iterator);
        success = target_iterator_has_succeeded(iterator.data);

        /* Cleanup */
        destroy_target_pid_iterator(&iterator);
        delete_target_array(target_array);

        /* Return the exit status, which is 0 if everything succeeds */
        return (!success);
    }
}