-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4: createStone.solo and deleteStone.solo pretty solid
- Loading branch information
1 parent
c463cf2
commit 3f3006f
Showing
11 changed files
with
163 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/GsDevKit_stones-Core.package/GDKStoneSpec.class/instance/stopStone..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
runtime | ||
stopStone: superDoitScriptOrNil | ||
| exitStatus arrayOfOutputs stdout scriptPath | | ||
scriptPath := ''. | ||
stdout := superDoitScriptOrNil | ||
ifNotNil: [ | ||
scriptPath := superDoitScriptOrNil scriptPath. | ||
superDoitScriptOrNil stdout ] | ||
ifNil: [ GsFile stdout ]. | ||
stdout | ||
lf; | ||
nextPutAll: | ||
'====== ' , scriptPath , ' stopping stone at ' , DateAndTime now printString; | ||
lf; | ||
lf. | ||
exitStatus := 0. | ||
[ | ||
arrayOfOutputs := (Rowan globalNamed: 'GsStopStone') | ||
stopStone: self stoneName | ||
userName: self userId | ||
password: self password ] | ||
on: ChildError | ||
do: [ :ex | | ||
" stopstone exit status: | ||
* 0 (success) Successful stop | ||
* 1 (informational) No running stone with that stonename | ||
* 2 (warning) | ||
* 3 or above (error) an error occurred and the specified stone was not stopped. | ||
* 10 syntax error | ||
* 11 bad user or password | ||
* 12 specified user does not have privilege to stop the stone. | ||
* 13 stone not stopped; other users logged in. Use -i to override." | ||
exitStatus := ex status ]. | ||
exitStatus = 0 | ||
ifTrue: [ stdout nextPutAll: (arrayOfOutputs at: 1) "stdout" ] | ||
ifFalse: [ | ||
exitStatus = 1 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: 'No running stone with the name ' , self stoneName printString; | ||
lf ] | ||
ifFalse: [ | ||
exitStatus = 2 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: 'warning '; | ||
lf ] | ||
ifFalse: [ | ||
(exitStatus >= 3 and: [ exitStatus <= 9 ]) | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: 'Stone not stopped'; | ||
lf ] | ||
ifFalse: [ | ||
exitStatus = 10 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: 'Syntax error. Stone not stopped'; | ||
lf ] | ||
ifFalse: [ | ||
exitStatus = 11 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: 'Bad user or password. Stone not stopped'; | ||
lf ] | ||
ifFalse: [ | ||
exitStatus = 12 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: | ||
'Specified user does not have privilege to stop the stone. Stone not stopped'; | ||
lf ] | ||
ifFalse: [ | ||
exitStatus = 13 | ||
ifTrue: [ | ||
stdout | ||
nextPutAll: | ||
'other users logged in. Use -i to override Stone not stopped'; | ||
lf ] ] ] ] ] ] ]. | ||
self error: 'Stone not stopped' ]. | ||
stdout | ||
nextPutAll: '****************************************'; | ||
lf |
3 changes: 3 additions & 0 deletions
3
src/GsDevKit_stones-Core.package/GDKStoneSpec.class/instance/stopStone.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
runtime | ||
stopStone | ||
self stopStone: nil |
19 changes: 19 additions & 0 deletions
19
src/GsDevKit_stones-Core.package/GDKStoneSpec.class/instance/waitStone..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
runtime | ||
waitStone: timeout | ||
"return exit status of waitstone command" | ||
|
||
| exitStatus | | ||
exitStatus := 0. | ||
[ | ||
(Rowan globalNamed: 'GsWaitStone') | ||
waitForStoneName: self stoneName | ||
timeout: timeout ] | ||
on: ChildError | ||
do: [ :ex | | ||
" stopstone exit status: | ||
0 if the server (netldi or stone) is ready, | ||
1 if the server is already already servicing the maximum number of sessions, | ||
2 if the server is rejecting connections during startup or shutdown, | ||
3 if the server was not found." | ||
exitStatus := ex status ]. | ||
^ exitStatus |
6 changes: 0 additions & 6 deletions
6
src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/destroyStoneNamed..st
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...sDevKit_stones-Core.package/GDKStonesRegistry.class/instance/destroyStoneStructureFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
stone management | ||
destroyStoneStructureFor: stoneName | ||
| stoneSpec status | | ||
stoneSpec := self stoneNamed: stoneName. | ||
(stoneSpec waitStone: 1) = 0 | ||
ifTrue: [ | ||
| count | | ||
"if running, stop the stone" | ||
stoneSpec stopStone. | ||
count := 0. | ||
[ (status := stoneSpec waitStone: 1) ~= 3 ] | ||
whileTrue: [ | ||
"ensure the stone has shut down, before destroying directory structure" | ||
count := count + 1. | ||
count > 2 | ||
ifTrue: [ self error: 'Cannot stop stone' ]. | ||
Delay waitForSeconds: 1 ] ]. | ||
stoneSpec destroyStoneStructure. | ||
self stones removeKey: stoneName. | ||
self export |
4 changes: 3 additions & 1 deletion
4
src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/stoneNamed.ifAbsent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
accessing | ||
stoneNamed: stoneName ifAbsent: absentBlock | ||
^ self stones at: stoneName ifAbsent: absentBlock | ||
| stonePath | | ||
stonePath := self stones at: stoneName ifAbsent: absentBlock. | ||
^ GDKAbstractRegistryStore fromPath: stonePath ifAbsent: absentBlock |