def profile_rule_update(name): """Update the rules on the profile""" try: nmp = NetworkMappedProfile(name) except KeyError: print "Profile %s not found." % name sys.exit(1) # Read in the JSON from standard in. rules_str = sys.stdin.read() rules = Rules.from_json(rules_str) nmp.profile.rules = rules nmp.update_rules() print "Successfully updated rules on profile %s" % name
def profile_rule_update(name): """Update the rules on the profile""" try: profile = client.get_profile(name) except KeyError: print "Profile %s not found." % name sys.exit(1) # Read in the JSON from standard in. rules_str = sys.stdin.read() rules = Rules.from_json(rules_str) if rules.id != name: print 'Rules JSON "id"=%s doesn\'t match profile name %s.' % (rules.id, name) sys.exit(1) profile.rules = rules client.profile_update_rules(profile) print "Successfully updated rules on profile %s" % name
def profile_rule_update(name): """Update the rules on the profile""" try: profile = client.get_profile(name) except KeyError: print "Profile %s not found." % name sys.exit(1) # Read in the JSON from standard in. rules_str = sys.stdin.read() rules = Rules.from_json(rules_str) if rules.id != name: print 'Rules JSON "id"=%s doesn\'t match profile name %s.' % \ (rules.id, name) sys.exit(1) profile.rules = rules client.profile_update_rules(profile) print "Successfully updated rules on profile %s" % name