def start(args): if len(args) >= 2: instance = args[0] imagename = args[1] doattach = common.item(args, 2, False) if doattach == "attach": doattach=True if not instance in ["new", "last", "stable"]: common.fail("Incorrect instance name. Please use 'new', 'last', or 'stable' ") if instance == "new": containername = start_new_container(imagename, doattach) else: containername = store.read_data(instance, imagename) if containername: start_container(imagename, containername, doattach) else: common.fail("No instance %s for image %s"%(instance, imagename)) elif len(args) == 1: containername = args[0] imagename = extract_image_name(containername) if imagename: start_container(imagename, containername) else: common.fail("Unknown. Use 'jockler start {new|last|stable} IMAGE' or 'jockler start CONTAINER'")
def dockerfiles_for(imagename, args): dockerfile = "%s-Dockerfile" % imagename if not os.path.isfile(dockerfile): dockerfile = os.path.abspath(common.item(args, 1, "Dockerfile")) build_path = os.path.abspath(os.path.join(dockerfile, os.pardir)) return dockerfile, build_path
def dump(args): replacement = common.item(args, 0, None) readmefile = ["readme.md"] sdata = store.load(readmefile) if replacement: sdata = sdata.replace("MYAPP", replacement) print(sdata)
def listing(args): if not common.args_check(args, 2): common.fail(helpstr) category = args[0] imagename = common.item(args, 1) if imagename == ".all" or imagename == None: list_all(category) else: list_on_image(imagename, category)
def stop(args): if not common.args_check(args, 1): common.fail("Unknown sequence for stop: %s" % ' '.join(args)) imagename = args[0] forcemode = False if imagename == "-f" and common.item(args, 1, None) != None: forcemode = True if forcemode: for containername in args[1:]: force_stop(containername) else: stop_containers(imagename)
def getAllPractice(): print "getAllPractice" conn = MySQLdb.connect(host="localhost", user="******", passwd="", db="niu", port=3306, charset="utf8") # 连接对象 results = [] cur = conn.cursor() # 游标对象 cur.execute("select * from xinxin") data = cur.fetchall() for row in data: result = item(row[0], row[1], row[2], row[3], row[4], row[5], row[6]) results.append(result) return results
def getRightIdForTitleId(id): print "getRightIdForTitleId %d" % id conn = MySQLdb.connect(host="localhost", user="******", passwd="", db="niu", port=3306, charset="utf8") # 连接对象 results = [] cur = conn.cursor() # 游标对象 cur.execute("select * from xinxin where id=%d" % id) data = cur.fetchall() for row in data: result = item(row[0], row[1], row[2], row[3], row[4], row[5], row[6]) results.append(result) return results