36
36
in the specified repository so that metadata.yaml can be inspected
37
37
to find the maintainer.""")
38
38
parser.add_argument('--subscribed', default=False, action='store_true',
39
help='Show maintainers who are properly subscribed instead of '
39
help='Show maintainers who are properly subscribed '
40
'instead of unsubscribed')
41
41
parser.add_argument('--repository', default=None, type=str,
42
help='Repository to look for charms in. Defaults to $JUJU_REPOSITORY '
42
help='Repository to look for charms in. Defaults to '
43
'$JUJU_REPOSITORY or getcwd')
44
44
parser.add_argument('--quiet', default=False, action='store_true',
45
help='Hide everything except maintainer subscription lists.')
45
help='Hide everything except maintainer subscription '
46
47
parser.add_argument('--series', '-s', default=None,
47
help='Which series of the charm store to run against. Defaults to '
48
+ 'current dev focus')
48
help='Which series of the charm store to run against. '
49
'Defaults to current dev focus')
49
50
parser.add_argument('--maintainer', default=None,
50
help='Limit output to this maintainer\'s charms only.')
51
help='Limit output to this maintainer\'s charms only.')
51
52
parser.add_argument('--log-priority', default='WARNING')
52
53
parser.add_argument('--launchpad-instance', default='production')
53
54
parser.add_argument('--fix-unsubscribed', default=False, action='store_true',
54
help='Add a bug subscription for any unsubscribed maintainers. Requires '
55
help='Add a bug subscription for any unsubscribed '
56
'maintainers. Requires --maintainer')
56
57
parser.add_argument('--force-fix-all', default=False, action='store_true',
57
help=argparse.SUPPRESS)
58
help=argparse.SUPPRESS)
58
59
parser.add_argument('charms', default=[], nargs='*',
59
help='Charms to check for subscriptions')
60
help='Charms to check for subscriptions')
61
62
args = parser.parse_args()
79
80
log_prio = logging.DEBUG
81
82
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
85
86
logging.disable(logging.WARNING)
87
88
if args.maintainer is None and args.fix_unsubscribed:
88
89
warn('Running --fix-unsubscribed and without --maintainer is against'
90
91
if not args.force_fix_all:
91
92
warn('Use --force-fix-all to override policy')
103
104
login = launchpad.Launchpad.login_anonymously
105
106
lp = login(app_name, args.launchpad_instance,
106
version='devel', launchpadlib_dir=launchpadlib_dir)
107
version='devel', launchpadlib_dir=launchpadlib_dir)
108
109
charmdistro = lp.distributions['charms']
132
133
for charm_name in charms:
134
135
with open('%s/%s/%s/metadata.yaml' % (repository, current_series,
135
charm_name)) as mdata:
136
charm_name)) as mdata:
136
137
mdata_parsed = yaml.safe_load(mdata)
138
139
warn('%s/%s has no metadata in charm repo' % (current_series,
142
143
maintainers = mdata_parsed['maintainer']