Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec command error when I ignore output #548

Closed
lalor opened this issue Jun 30, 2015 · 2 comments
Closed

exec command error when I ignore output #548

lalor opened this issue Jun 30, 2015 · 2 comments

Comments

@lalor
Copy link

lalor commented Jun 30, 2015

I use paramaiko to exec some command in remote VM.

There is something wrong when I ignore output of exec_command, when I fetch out the result of exec_command, It' will be right. Is there has some bugs ?

the right code:

def upgrade_agent(ssh, agent):                                                          
    """upgrade agent"""                                                                 

    target_alias = "NewAgent"                                                           
    with ssh.open_sftp() as sftp:                                                                                                                     
        sftp.put(agent, agent)                                                          

        cmds = ["tar -zxf {0}".format(agent),                                           
                "rm {0}".format(agent),                                                 
                "[ -e AgentBackup ] && rm -rf AgentBackup",                             
                "mv  rdsAgent AgentBackup",                                             
                "mv {0} rdsAgent".format(target_alias),                                 
                "cp AgentBackup/config/RDSAgent.cnf rdsAgent/config/RDSAgent.cnf",   
                "cat ~/log/agent.pid  | xargs kill -9",                                 
                "~rds-user/rdsAgent/agent_safe"]                                        

        for cmd in cmds:                                                                
            _, stdout, _ = ssh.exec_command(cmd)                                        
            a = stdout.readlines() 

the wrong code

        for cmd in cmds:                                                                
            ssh.exec_command(cmd)                                        

@lalor
Copy link
Author

lalor commented Jul 1, 2015

I think that this problem is some with #550

@bitprophet
Copy link
Member

Yea, this sounds likely to be the same as #550 - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants