~landscape/landscape-charm/tools

« back to all changes in this revision

Viewing changes to collect-logs

  • Committer: Andreas Hasenack
  • Date: 2016-07-28 19:22:49 UTC
  • mfrom: (15.1.1 juju-ssh-with-debug)
  • Revision ID: andreas@canonical.com-20160728192249-0bv4pgyqg5jj32gz
Merged juju-ssh-with-debug to try to catch #1607076

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    ps_cmd = "ps fauxww | sudo tee /var/log/ps-fauxww.txt"
55
55
    try:
56
56
        log.info("Collecting ps output on unit {}".format(unit))
57
 
        check_output(["juju", "ssh", unit, ps_cmd], stderr=STDOUT)
 
57
        check_output(["juju", "ssh", unit, "-v", ps_cmd], stderr=STDOUT)
58
58
    except CalledProcessError as e:
59
59
        log.warning(
60
60
            "Failed to collect running processes on unit {}".format(unit))
77
77
        tar_cmd, exclude, logsuffix, logs)
78
78
    try:
79
79
        log.info("Creating tarball on unit {}".format(unit))
80
 
        check_output(["juju", "ssh", unit, cmd], stderr=STDOUT)
 
80
        check_output(["juju", "ssh", unit, "-v", cmd], stderr=STDOUT)
81
81
    except CalledProcessError as e:
82
82
        log.warning(
83
83
            "Failed to create remote log tarball on unit {}".format(unit))
138
138
        return
139
139
    log.info("Found landscape unit %s" % landscape_unit)
140
140
    try:
141
 
        check_output(["juju", "ssh", landscape_unit, poke_inner_env])
 
141
        check_output(["juju", "ssh", "-v", landscape_unit, poke_inner_env])
142
142
    except CalledProcessError:
143
143
        log.info("No active inner environment found on %s, skipping" %
144
144
                 landscape_unit)
145
145
        return
146
146
    call(["juju", "scp", PRG, "%s:%s" % (landscape_unit, collect_logs)])
147
 
    call(["juju", "ssh", landscape_unit, "sudo rm -rf /tmp/inner-logs.tar.*"])
 
147
    call(["juju", "ssh", landscape_unit, "-v",
 
148
          "sudo rm -rf /tmp/inner-logs.tar.*"])
148
149
    log.info("Collecting Logs on inner environment")
149
150
    check_call(
150
 
        ["juju", "ssh", landscape_unit, "sudo -u landscape %s" % collect_run])
 
151
        ["juju", "ssh", landscape_unit, "-v",
 
152
         "sudo -u landscape %s" % collect_run])
151
153
    log.info("Copying inner environment back")
152
154
    check_call(["juju", "scp", "%s:/tmp/inner-logs.tar.gz" % landscape_unit,
153
155
               "."])