FAQ
Hello,

I'm trying to thread the command client.cmd('*','state.highstate') and i
want to display the final output. Here is the code I am using:

import salt.client
import salt.config
import thread, time
import threading

def thread_state(test):
     client = salt.client.LocalClient()
     test['id'] = client.cmd('*','state.highstate')

test = { "id": 1 }

thread.start_new_thread(thread_state, (test,))

time.sleep(1)

print test['id']


I am receiving output but it's not what I am looking for, I am getting:

  {'SaltMinion-Windows': ['The function "state.highstate" is running as PID
1420 and was started at 2015, Apr 15 10:13:54.642723 with jid
20150415101354642723']}

Does anyone know how I go about getting the final output displaying which
packages have been installed and which have failed.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Colton Myers at Apr 22, 2015 at 8:46 pm
    I would recommend just running the job with `--async` (async=True in the
    API, maybe? I know it's supported. Might just be `cmd_async`, actually).
    Then you should have a loop that sleeps and then queries the job cache
    until the job is present there. (Using RunnerClient and the jobs.lookup_jid
    runner)

    --
    Colton Myers
    Platform Engineer, SaltStack
    @basepi on Twitter/Github/IRC
    On Wed, Apr 15, 2015 at 9:33 AM, Charles Moore wrote:

    Hello,

    I'm trying to thread the command client.cmd('*','state.highstate') and i
    want to display the final output. Here is the code I am using:

    import salt.client
    import salt.config
    import thread, time
    import threading

    def thread_state(test):
    client = salt.client.LocalClient()
    test['id'] = client.cmd('*','state.highstate')

    test = { "id": 1 }

    thread.start_new_thread(thread_state, (test,))

    time.sleep(1)

    print test['id']


    I am receiving output but it's not what I am looking for, I am getting:

    {'SaltMinion-Windows': ['The function "state.highstate" is running as PID
    1420 and was started at 2015, Apr 15 10:13:54.642723 with jid
    20150415101354642723']}

    Does anyone know how I go about getting the final output displaying which
    packages have been installed and which have failed.

    Thanks.

    --
    You received this message because you are subscribed to the Google Groups
    "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedApr 15, '15 at 3:33p
activeApr 22, '15 at 8:46p
posts2
users2

2 users in discussion

Charles Moore: 1 post Colton Myers: 1 post

People

Translate

site design / logo © 2021 Grokbase