Skip to content

Commit d7a8565

Browse files
committed
fixed a problem occurring when using lstart after lcrash instead of lclean. Also added notices to commands that do not delete containers
1 parent 64ab38d commit d7a8565

File tree

7 files changed

+8
-3
lines changed

7 files changed

+8
-3
lines changed

bin/lclean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ done
2929

3030
export RC=$?
3131
if [ "$RC" = "0" ]; then
32-
32+
echo -e "\033[0;33mContainers will be deleted\033[0m"
3333
M=_machines
3434
L=_links
3535
if [ "$NETKIT_ALL" = "1" ]; then

bin/lclean.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ FOR /F "tokens=*" %%a in ('python %NETKIT_HOME%\python\folder_hash.py "%cd%/" %*
2424
FOR /F "tokens=*" %%a in ('python %NETKIT_HOME%\python\folder_hash.py "%cd%/" %*') DO SET VAR2=%NETKIT_HOME%\temp\%%a_links
2525

2626
IF "%NETKIT_ALL%" == "1" (
27+
ECHO "Containers will be deleted"
2728
IF exist %VAR1% (
2829
FOR /f "delims=" %%a in (%VAR1%) DO docker rm -f %%a
2930
)

bin/lcrash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if [ "$RC" = "0" ]; then
3535
if [ "$NETKIT_ALL" = "1" ]; then
3636
python $NETKIT_HOME/python/folder_hash.py "$PWD/" $@ | while read in; do (
3737
if [ -f "$HOME/netkit_temp/$in$M" ]; then
38+
echo -e "\033[0;33mContainers will be stopped (forcefully) but not deleted\033[0m"
3839
$NETKIT_HOME/wrapper/bin/netkit_dw kill `cat "$HOME/netkit_temp/$in$M"`
3940
fi
4041
); done

bin/lcrash.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FOR %%p in (%*) DO (
2121
)
2222

2323
IF "%NETKIT_ALL%" == "1" (
24+
ECHO "Containers will be stopped (forcefully) but not deleted"
2425
FOR /F "tokens=*" %%a in ('python %NETKIT_HOME%\python\folder_hash.py "%cd%/" %*') DO SET VAR1=%NETKIT_HOME%\temp\%%a_machines
2526
IF exist %VAR1% (
2627
FOR /f "delims=" %%a in (%VAR1%) DO docker kill %%a

bin/lhalt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ done
2929

3030
export RC=$?
3131
if [ "$RC" = "0" ]; then
32-
32+
echo -e "\033[0;33mContainers will be stopped (gracefully) but not deleted\033[0m"
3333
M=_machines
3434
L=_links
3535
if [ "$NETKIT_ALL" = "1" ]; then

bin/lhalt.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FOR %%p in (%*) DO (
2121
)
2222

2323
IF "%NETKIT_ALL%" == "1" (
24+
ECHO "Containers will be stopped (gracefully) but not deleted"
2425
FOR /F "tokens=*" %%a in ('python %NETKIT_HOME%\python\folder_hash.py "%cd%/" %*') DO SET VAR1=%NETKIT_HOME%\temp\%%a_machines
2526
IF exist %VAR1% (
2627
FOR /f "delims=" %%a in (%VAR1%) DO docker stop %%a

bin/python/netkit_commons.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def create_commands(machines, links, options, metadata, path, execbash=False, no
223223
for link,_ in interfaces[1:]:
224224
repls = ('{link}', link), ('{machine_name}', machine_name)
225225
create_connection_commands.append(u.replace_multiple_items(repls, create_connection_template))
226-
if os.path.exists(os.path.join(path, machine_name)):
226+
# convoluted method to copy MACHINE_NAME/etc folder to the etc of the container
227+
if os.path.exists(os.path.join(path, machine_name)) and not execbash:
227228
for folder_or_file in os.listdir(os.path.join(path, machine_name)):
228229
if folder_or_file == 'etc':
229230
repls = ('{machine_name}', machine_name), ('{machine_name}', machine_name), ('{folder_or_file}', folder_or_file), ('{dest}', 'temp_etc')

0 commit comments

Comments
 (0)