link_credentials.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Network-Automation-with-Python-and-Ansible-class 作者: pmusolino-rms 项目源码 文件源码
def main():
    """
    Main Process
    """
    django.setup()

    devices = NetworkDevice.objects.all()
    creds = Credentials.objects.all()
    std_cred = creds[0]
    arista_cred = creds[1]

    for dev in devices:
        if 'pynet-sw' in dev.device_name:
            dev.credentials = arista_cred
        else:
            dev.credentials = std_cred
        dev.save()

    for dev in devices:
        print dev.device_name, dev.credentials
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号