mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Remove manage-credentials, and credential handling code from
ubuntutools.lp.libsupport. Launchpadlib 1.9 handles this via python-keyring.
This commit is contained in:
parent
755166deec
commit
dd7fd86c3d
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,3 +1,11 @@
|
||||
ubuntu-dev-tools (0.119) UNRELEASED; urgency=low
|
||||
|
||||
* Remove manage-credentials, and credential handling code from
|
||||
ubuntutools.lp.libsupport. Launchpadlib 1.9 handles this via
|
||||
python-keyring.
|
||||
|
||||
-- Stefano Rivera <stefanor@debian.org> Thu, 24 Feb 2011 16:28:33 +0200
|
||||
|
||||
ubuntu-dev-tools (0.118) unstable; urgency=low
|
||||
|
||||
* requestsync: Use from...import require_utf8() to work around unexpected
|
||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -88,7 +88,6 @@ Description: useful tools for Ubuntu developers
|
||||
- lp-list-bugs - briefly list status of Launchpad bugs.
|
||||
- lp-project-upload - upload a release tarball to a Launchpad project
|
||||
- lp-set-dup - sets the "duplicate of" bug of a bug and its dups.
|
||||
- manage-credentials - manage Launchpad token credentials.
|
||||
- massfile - fill multiple bugs using a template.
|
||||
- merge-changelog - manually merges two Debian changelogs with the same base
|
||||
version.
|
||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -129,7 +129,6 @@ Files: dch-repeat
|
||||
doc/get-build-deps.1
|
||||
doc/grep-merges.1
|
||||
doc/lp-list-bugs.1
|
||||
doc/manage-credentials.1
|
||||
doc/mk-sbuild.1
|
||||
doc/pull-lp-source.1
|
||||
doc/pull-revu-source.1
|
||||
@ -138,7 +137,6 @@ Files: dch-repeat
|
||||
get-build-deps
|
||||
grep-merges
|
||||
lp-list-bugs
|
||||
manage-credentials
|
||||
mk-sbuild
|
||||
pull-lp-source
|
||||
pull-revu-source
|
||||
|
@ -1,69 +0,0 @@
|
||||
.TH MANAGE-CREDENTIALS "1" "13 January 2009" "ubuntu-dev-tools"
|
||||
.SH NAME
|
||||
manage-credentials \- a tool to create (and manage) credentials which
|
||||
are used to access launchpad via the API.
|
||||
.SH SYNOPSIS
|
||||
.B manage-credentials create -c <consumer> [--email <email> --password <password>] [--service <staging|edge>]
|
||||
.br
|
||||
.B manage-credentials \-h
|
||||
.SH DESCRIPTION
|
||||
\fBmanage-credentials\fR is a tool to create (and manage) credentials which
|
||||
are used to access Launchpad via the API.
|
||||
|
||||
.PP
|
||||
Currently this tool can be used
|
||||
to create a token with or without using the web UI. In the future, once
|
||||
related methods are available through the API, this tool can also be used
|
||||
to manage tokens in launchpad and on the users local machine.
|
||||
|
||||
.SH OPTIONS
|
||||
Listed below are the command line options for requestsync:
|
||||
.TP
|
||||
.B \-h
|
||||
Display a help message and exit.
|
||||
.TP
|
||||
.B \-c \-\-consumer
|
||||
.TP
|
||||
.B \-e \-\-email <email>
|
||||
Your email address as registered on Launchpad.
|
||||
.TP
|
||||
.B \-p \-\-password <password>
|
||||
Your Launchpad password.
|
||||
.TP
|
||||
.B \-s \-\-service <edge|staging>
|
||||
If we should use the edge or staging root of the Launchpad API.
|
||||
.TP
|
||||
.B \-\-cache
|
||||
Where to store the cache.
|
||||
.TP
|
||||
.B \-o
|
||||
Which file we should save the credentials to. By default
|
||||
\fBmanage-credentials\fR writes the credentials tokens to the
|
||||
~/.cache/lp_credentials/ directory.
|
||||
.TP
|
||||
.B \-l \-\-level <number>
|
||||
A number representing the access-level you wish to give to the new
|
||||
Launchpad token. 0 is unauthorized, 1 is read public data, 2; write public data,
|
||||
3; read private data and 4; write private data.
|
||||
|
||||
.SH EXAMPLE USAGE
|
||||
To get Launchpad tokens using \fBmanage-credentials\fR, run the following command:
|
||||
.TP
|
||||
manage-credentials create \-c CONSUMER \-\-level 2
|
||||
|
||||
.TP
|
||||
This will open your web browser with a Launchpad login page.
|
||||
|
||||
.TP
|
||||
If you intend to use manage-credentials for Ubuntu development (such as
|
||||
the ubuntu-dev-tools package). Please be sure to run the following:
|
||||
|
||||
.TP
|
||||
manage-credentials create \-c ubuntu-dev-tools \-l 2
|
||||
|
||||
.SH AUTHOR
|
||||
.B manage-credentials
|
||||
was written by Markus Korn <thekorn@gmx.de> and this manual page was written by
|
||||
Jonathan Davies <jpds@ubuntu.com>.
|
||||
.PP
|
||||
Both are released under the GNU General Public License, version 3.
|
@ -33,8 +33,7 @@ answer the question about upload permissions honestly to determine if a team
|
||||
with approval rights is to be subscribed to the bug.
|
||||
|
||||
.PP
|
||||
\fBrequestsync\fR uses launchpadlib authentication to file its requests. Please
|
||||
see manage-credentials(1) for more information.
|
||||
\fBrequestsync\fR uses launchpadlib authentication to file its requests.
|
||||
|
||||
.SH OPTIONS
|
||||
Listed below are the command line options for requestsync:
|
||||
|
@ -65,9 +65,6 @@ def main():
|
||||
print "Launchpad setup complete"
|
||||
except ImportError:
|
||||
suggestion = "check whether python-launchpadlib is installed"
|
||||
except IOError:
|
||||
suggestion = "you might want to \"manage-credentials create " + \
|
||||
"--consumer ubuntu-dev-tools --level 2\""
|
||||
if launchpad is None:
|
||||
die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % \
|
||||
(suggestion, ))
|
||||
|
@ -1,132 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2009 Markus Korn <thekorn@gmx.de>
|
||||
#
|
||||
# ##################################################################
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 3
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# See file /usr/share/common-licenses/GPL for more details.
|
||||
#
|
||||
# ##################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
from optparse import OptionParser, make_option
|
||||
from launchpadlib.uris import lookup_service_root
|
||||
from ubuntutools.lp.libsupport import Launchpad, translate_api_web, LEVEL
|
||||
|
||||
class CmdOptions(OptionParser):
|
||||
|
||||
USAGE = (
|
||||
"\t%prog create -c <consumer> [--service <staging|production>]"
|
||||
)
|
||||
|
||||
OPTIONS = (
|
||||
make_option("-c", "--consumer", action="store", type="string",
|
||||
dest="consumer", default=None),
|
||||
make_option("-s", "--service", action="store", type="string",
|
||||
dest="service", default="production"),
|
||||
make_option("--cache", action="store", type="string",
|
||||
dest="cache", default=None),
|
||||
make_option("-o", action="store", type="string",
|
||||
dest="output", default=None),
|
||||
make_option("-l", "--level", action="store", type="int",
|
||||
dest="level", default=0,
|
||||
help="integer representing the access-level (default: 0), "
|
||||
"mapping: %s" % LEVEL),
|
||||
)
|
||||
|
||||
TOOLS = {
|
||||
"create": ( ("consumer",),
|
||||
("service", "cache", "output",
|
||||
"level")),
|
||||
"list": (tuple(), ("service", )),
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
OptionParser.__init__(self, option_list=self.OPTIONS)
|
||||
self.set_usage(self.USAGE)
|
||||
|
||||
def parse_args(self, args=None, values=None):
|
||||
options, args = OptionParser.parse_args(self, args, values)
|
||||
given_options = set(i for i, k in self.defaults.iteritems()
|
||||
if not getattr(options, i) == k)
|
||||
|
||||
if not args:
|
||||
self.error("Please define a sub-tool you would like to use")
|
||||
if not len(args) == 1:
|
||||
self.error("Only one sub-tool allowed")
|
||||
else:
|
||||
tool = args.pop()
|
||||
if not tool in self.TOOLS:
|
||||
self.error("Unknown tool '%s'" %tool)
|
||||
needed_options = set(self.TOOLS[tool][0]) - given_options
|
||||
if needed_options:
|
||||
self.error("Please define the following options: %s" % \
|
||||
", ".join(needed_options))
|
||||
optional_options = given_options - set(sum(self.TOOLS[tool], ()))
|
||||
if optional_options:
|
||||
self.error("The following options are not allowed for this tool: "
|
||||
"%s" % ", ".join(optional_options))
|
||||
options.service = lookup_service_root(options.service)
|
||||
if options.level in LEVEL:
|
||||
options.level = LEVEL[options.level]
|
||||
elif options.level.upper() in LEVEL.values():
|
||||
options.level = options.level.upper()
|
||||
else:
|
||||
self.error("Unknown access-level '%s', level must be in %s" %
|
||||
(options.level, LEVEL))
|
||||
return tool, options
|
||||
|
||||
def create_credentials(options):
|
||||
launchpad = Launchpad.get_token_and_login(options.consumer,
|
||||
options.service, options.cache)
|
||||
credentials = launchpad.credentials
|
||||
|
||||
if options.output:
|
||||
filepath = options.output
|
||||
else:
|
||||
credentials_dir = os.path.expanduser("~/.cache/lp_credentials")
|
||||
if not os.path.isdir(credentials_dir):
|
||||
os.makedirs(credentials_dir)
|
||||
os.chmod(credentials_dir, 0700)
|
||||
filepath = os.path.expanduser("%s/%s-%s.txt" %
|
||||
(credentials_dir, options.consumer,
|
||||
str(options.level).lower()))
|
||||
|
||||
f = open(filepath, "w")
|
||||
# Make credentials file non-world readable.
|
||||
os.chmod(filepath, 0600)
|
||||
credentials.save(f)
|
||||
f.close()
|
||||
|
||||
print "Credentials successfully written to %s." % filepath
|
||||
|
||||
return
|
||||
|
||||
def list_tokens(options):
|
||||
print "Not implemented yet."
|
||||
print ("To get a list of your tokens, please visit "
|
||||
"%speople/+me/+oauth-tokens") % translate_api_web(options.service)
|
||||
return 1
|
||||
|
||||
def main():
|
||||
cmdoptions = CmdOptions()
|
||||
tool, options = cmdoptions.parse_args()
|
||||
if tool == "create":
|
||||
return create_credentials(options)
|
||||
elif tool == "list":
|
||||
return list_tokens(options)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
Loading…
x
Reference in New Issue
Block a user