4 ## Copyright (c) 2010-2017 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
23 def ssh(user, ip, cmd):
26 ssh_options += "-o StrictHostKeyChecking=no "
27 ssh_options += "-o UserKnownHostsFile=/dev/null "
28 ssh_options += "-o LogLevel=quiet "
29 running = os.popen("ssh " + ssh_options + " " + user + "@" + ip + " \"" + cmd + "\"");
31 ret['out'] = running.read().strip();
32 ret['ret'] = running.close();
33 if (ret['ret'] == None):
38 def ssh_check_quit(obj, user, ip, cmd):
39 ret = ssh(user, ip, cmd);
42 obj._err_str = ret['out'];
46 def __init__(self, user, ip):
51 return ssh(self._user, self._ip, cmd);
53 def scp(self, src, dst):
54 running = os.popen("scp " + self._user + "@" + self._ip + ":" + src + " " + dst);
55 return running.close();