salt ext_pillar

参考 https://github.com/shencan/saltpillar 

书中247页


#GitPython and pygit2

1.master

python2.6.6

yum install GitPython


2.有个bug,用最新的gitdb替换掉就的gitdb

https://github.com/gitpython-developers/gitdb/tree/master/gitdb


wKioL1mmXwGwng3tAAAwgl4zXaA397.png


3.修改master

ext_pillar:

    - git: base https://github.com/shencan/saltpillar.git

    - git: stage https://github.com/shencan/saltpillar.git


4.salt-run git_pillar.update branch='stage' repo='http://自己的git地址/shencan/saltpillar.git' -l debug

salt-run git_pillar.update branch='base'  repo='http://自己的git地址/shencan/saltpillar.git' -l debug


5.[root@node src]# salt '*' pillar.items

122:

    ----------

    pkgs:

        ----------

        pip:

            ----------

            ansible:

                1.9.1

            awscli:

                1.3.0

    users:

        ----------

        shencan:

            ----------

            fullname:

                shencan

            shell:

                /bin/bash


惭愧,搞了好几天。没耐心啊。


这个具体有什么用,比如你可以在git存放数据库密码,然后git pillar更新装有mysql的客户端,之后可以对mysql进行操作。


salt感觉很快。




本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1961084,如需转载请自行联系原作者

# 初始化障碍物和柱子墙位置 obstacle_x = SCREEN_WIDTH pillar_x = [SCREEN_WIDTH + PILLAR_DISTANCE, SCREEN_WIDTH + PILLAR_DISTANCE * 2, SCREEN_WIDTH + PILLAR_DISTANCE * 3] # 游戏循环 while True: # 显示障碍物和柱子墙 draw_obstacle(obstacle_x, obstacle_y, obstacle_width, obstacle_height) for i in range(3): draw_pillar(pillar_x[i], pillar_height[i]) # 移动障碍物和柱子墙 obstacle_x -= OBSTACLE_SPEED for i in range(3): pillar_x[i] -= OBSTACLE_SPEED # 重新生成障碍物和柱子墙 if obstacle_x < -OBSTACLE_WIDTH: obstacle_x = SCREEN_WIDTH obstacle_y = random.randint(0, SCREEN_HEIGHT - OBSTACLE_HEIGHT) for i in range(3): if pillar_x[i] < -PILLAR_WIDTH: pillar_x[i] = SCREEN_WIDTH + PILLAR_DISTANCE * (i + 1) pillar_height[i] = random.randint(0, SCREEN_HEIGHT - PILLAR_GAP) # 初始化小鸟位置和速度 bird_x = BIRD_X bird_y = SCREEN_HEIGHT // 2 bird_v = 0 # 游戏循环 while True: # 监听用户输入 for event in pygame.event.get(): if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: bird_v = BIRD_JUMP_SPEED # 移动小鸟 bird_y += bird_v bird_v += BIRD_GRAVITY # 碰撞检测 if bird_x + BIRD_WIDTH > obstacle_x and bird_x < obstacle_x + OBSTACLE_WIDTH \ and (bird_y < obstacle_y or bird_y + BIRD_HEIGHT > obstacle_y + OBSTACLE_HEIGHT): break for i in range(3): if bird_x + BIRD_WIDTH > pillar_x[i] and bird_x < pillar_x[i] + PILLAR_WIDTH \ and (bird_y < pillar_height[i] or bird_y + BIRD_HEIGHT > pillar_height[i] + PILLAR_GAP): break # 显示小鸟 draw_bird(bird_x, bird_y) # 游戏结束 if bird_y < 0 or bird_y + BIRD_HEIGHT > SCREEN_HEIGHT: break请帮我完善这段程序使其能在Python上运行不报错
05-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值