Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
EOLE
Zéphir
Services
SaltMaster manager
Commits
3c6652d1
Commit
3c6652d1
authored
Feb 12, 2019
by
Matthieu Lamalle
Committed by
Philippe Caseiro
Feb 12, 2019
Browse files
59 execution commande
parent
e096b404
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
3c6652d1
...
...
@@ -39,7 +39,7 @@ RUN git clone "${CONTAINERPILOT_REPO_URL}" "/tmp/orchestrate" \
# API messages description
ARG
MESSAGES_API_REPO_URL=https://gitlab.mim.ovh/EOLE/Zephir/messages-api.git
ARG
MESSAGES_API_REPO_REF=
9f534509
ARG
MESSAGES_API_REPO_REF=
0.0.3-dev
RUN
git clone
"
${
MESSAGES_API_REPO_URL
}
"
"/tmp/messages-api"
\
&&
cd
/tmp/messages-api
\
...
...
scripts/controller
View file @
3c6652d1
...
...
@@ -51,9 +51,9 @@ class SaltRunner(ZephirCommonController):
@
register_wamp
(
'v1.execution.salt.exec'
,
notification_uri
=
'v1.execution.salt.exec.command-executed'
)
async
def
exec_command
(
self
,
minion_pattern
,
command
,
arg
,
client_mode
):
async
def
exec_command
(
self
,
minion_pattern
,
command
,
arg
,
client_mode
,
tgt_type
):
try
:
ret
=
self
.
executor
.
exec_command
(
minion_pattern
,
command
,
arg
,
client_mode
)
ret
=
self
.
executor
.
exec_command
(
minion_pattern
,
command
,
arg
,
client_mode
,
tgt_type
)
return
ret
except
SaltExecErrorMissingMinionPattern
as
err
:
...
...
src/python/zephir/saltmaster/execute.py
View file @
3c6652d1
...
...
@@ -44,7 +44,7 @@ class SaltExec():
self
.
config
=
config
def
exec_command
(
self
,
minion_pattern
,
command
,
arg
=
None
,
client_mode
=
'local_async'
):
def
exec_command
(
self
,
minion_pattern
,
command
,
arg
=
None
,
client_mode
=
'local_async'
,
tgt_type
=
'glob'
):
msg
=
_
(
'Salt executor : shedule execution of “{}({})” on target “{}”'
)
print
(
msg
.
format
(
command
,
arg
or
""
,
minion_pattern
))
session
=
requests
.
Session
()
...
...
@@ -52,7 +52,7 @@ class SaltExec():
resp
=
session
.
post
(
'http://localhost:8000/login'
,
json
=
{
'username'
:
'eole'
,
'password'
:
'eole'
,
'eauth'
:
'pam'
,
'eauth'
:
'pam'
})
assert
resp
.
status_code
==
200
,
resp
.
reason
...
...
@@ -65,7 +65,8 @@ class SaltExec():
json_payload
=
{
'client'
:
client_mode
,
'tgt'
:
minion_pattern
,
'fun'
:
command
'fun'
:
command
,
'tgt_type'
:
tgt_type
}
if
arg
is
not
None
:
...
...
@@ -74,7 +75,9 @@ class SaltExec():
resp
=
session
.
post
(
'http://localhost:8000'
,
json
=
[
json_payload
])
assert
resp
.
status_code
==
200
,
resp
.
reason
print
(
resp
.
json
())
ret
=
resp
.
json
()[
'return'
][
0
]
print
(
ret
)
if
not
ret
:
raise
SaltExecError
(
_
(
'salt did not find any server to execute the command'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment