import merge code from cdist-manifest-run-all into cdist-type-emulator
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								2ef17f9bf2
							
						
					
				
			
			
				commit
				
					
						92860706b2
					
				
			
		
					 2 changed files with 56 additions and 0 deletions
				
			
		| 
						 | 
					@ -164,3 +164,56 @@ if [ -e "${__cdist_new_object_dir}" ]; then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# --------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # Verify no conflicting objects have been created
 | 
				
			||||||
 | 
					            while read __cdist_new_object; do
 | 
				
			||||||
 | 
					               __cdist_object_found=$(grep "^$__cdist_new_object\$" "$__cdist_objects_list" || true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					               if [ "$__cdist_object_found" ]; then
 | 
				
			||||||
 | 
					                  __cdist_object_source="$(cat "$(__cdist_object_dir "$__cdist_new_object")/${__cdist_name_object_source}")"
 | 
				
			||||||
 | 
					                  __cdist_exit_err "${__cdist_manifest}: ${__cdist_new_object} already exists (source: $__cdist_object_source)"
 | 
				
			||||||
 | 
					               fi
 | 
				
			||||||
 | 
					            done < "$__cdist_new_objects_list"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # Safe harbour: We can merge all objects into main tree
 | 
				
			||||||
 | 
					            # Merge = mkdir + mv parameters and source information
 | 
				
			||||||
 | 
					            while read __cdist_new_object; do
 | 
				
			||||||
 | 
					                [ "$__cdist_new_objects_created" = "n" ] && __cdist_new_objects_created="y"
 | 
				
			||||||
 | 
					               
 | 
				
			||||||
 | 
					               # where to save the newly created object
 | 
				
			||||||
 | 
					               __cdist_object_dir="$__cdist_out_object_dir/$__cdist_new_object"
 | 
				
			||||||
 | 
					               mkdir -p "$__cdist_object_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					               # Move parts of the object (CANNOT MOVE COMPLETLEY, HIERACHY!)
 | 
				
			||||||
 | 
					               __cdist_new_object_dir="$__cdist_new_objects_dir/$__cdist_new_object"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					               # Source
 | 
				
			||||||
 | 
					               mv "${__cdist_new_object_dir}/${__cdist_name_object_source}" \
 | 
				
			||||||
 | 
					                  "$__cdist_object_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					               # Explorer, Parameter, Require
 | 
				
			||||||
 | 
					               for __cdist_object_file in   \
 | 
				
			||||||
 | 
					                  ${__cdist_name_explorer}   \
 | 
				
			||||||
 | 
					                  ${__cdist_name_parameter}  \
 | 
				
			||||||
 | 
					                  ${__cdist_name_require}    \
 | 
				
			||||||
 | 
					                  ; do
 | 
				
			||||||
 | 
					                  
 | 
				
			||||||
 | 
					                  if [ -e "${__cdist_new_object_dir}/${__cdist_object_file}" ]; then
 | 
				
			||||||
 | 
					                     mv "${__cdist_new_object_dir}/${__cdist_object_file}" \
 | 
				
			||||||
 | 
					                     "$__cdist_object_dir"
 | 
				
			||||||
 | 
					                  fi
 | 
				
			||||||
 | 
					               done
 | 
				
			||||||
 | 
					            done < "$__cdist_new_objects_list"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            # Remove listing and objects, otherwise the next type will reuse it...
 | 
				
			||||||
 | 
					            rm -rf "$__cdist_new_objects_dir" "$__cdist_new_objects_list"
 | 
				
			||||||
 | 
					         else
 | 
				
			||||||
 | 
					            # Be nice, warn user if manifests exists, but is not executable
 | 
				
			||||||
 | 
					            if [ -f "${__cdist_manifest}" ]; then
 | 
				
			||||||
 | 
					               echo "Warning ${__cdist_manifest} exists, but is not executable." >&2
 | 
				
			||||||
 | 
					            fi
 | 
				
			||||||
 | 
					         fi
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,5 @@
 | 
				
			||||||
- think about using .cdist for meta information?
 | 
					- think about using .cdist for meta information?
 | 
				
			||||||
   - otherwise: parameter, gencode-local, etc. are not valid object id stuff
 | 
					   - otherwise: parameter, gencode-local, etc. are not valid object id stuff
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- check cdist-manifest-run-all whether -x -f to manifest shouldn't be better
 | 
				
			||||||
 | 
					   in cdist-manifest-run
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue