Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1010593 Details for
Bug 1189840
[atomic] Negative DNS caching of the dockerd breaks docker pull
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh92 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
ping in python
ping-after-iface-restart.py (text/plain), 1.61 KB, created by
Michal Minar
on 2015-04-03 10:39:10 UTC
(
hide
)
Description:
ping in python
Filename:
MIME Type:
Creator:
Michal Minar
Created:
2015-04-03 10:39:10 UTC
Size:
1.61 KB
patch
obsolete
>#!/usr/bin/env python > >import argparse >import httplib >import socket >import subprocess >import sys >import time > >INDEX_URL = "index.docker.io" > >def ping(): > print "Pinging index %s" % INDEX_URL > con = httplib.HTTPSConnection(INDEX_URL) > try: > con.request("GET", "/v1/_ping") > resp = con.getresponse() > print "Ping successful. StatusCode=%d, Registry Version: %s" % (resp.status, dict(resp.getheaders()).get("x-docker-registry-version", "unknown")) > except socket.gaierror as err: > print "Failed to ping %s: %s" %(INDEX_URL, err) > >def bring_iface(iface, up): > if up: > print 'Bringing interface "%s" up' % iface > else: > print 'Shutting down interface "%s"' % iface > try: > out = subprocess.check_output(["nmcli", "d", "connect" if up else "disconnect", iface]) > lines = [l for l in out.splitlines() if len(l) > 0] > if lines: > print lines[0] > except subprocess.CalledProcessError as err: > print 'Failed to %s interface "%s".' % ("bring up" if up else "shut down", iface) > sys.exit(1) > >def main(): > parser = argparse.ArgumentParser("Ping docker index after.") > parser.add_argument("-i", "--iface", help="The name of interface to restart.", default="eth0") > parser.add_argument("-o", "--once", help="Ping the index just once without any iface restart.", action='store_true') > args = parser.parse_args() > > ping() > if not args.once: > bring_iface(args.iface, up=False) > time.sleep(1) > ping() > bring_iface(args.iface, up=True) > time.sleep(1) > ping() > >if __name__ == "__main__": > main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1189840
:
1010091
|
1010094
| 1010593