Password prompt if key is not specified.
This commit is contained in:
parent
11aa56cc08
commit
66050b3338
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -46,6 +47,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
account = args[0]
|
account = args[0]
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -56,6 +57,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 3:
|
if len(args) != 3:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
account, user, password = args
|
account, user, password = args
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
|
@ -18,6 +18,7 @@ try:
|
|||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
import re
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@ -56,6 +57,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 0:
|
if len(args) != 0:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
options.admin_url = options.admin_url.rstrip('/')
|
options.admin_url = options.admin_url.rstrip('/')
|
||||||
if not options.admin_url.endswith('/v1.0'):
|
if not options.admin_url.endswith('/v1.0'):
|
||||||
options.admin_url += '/v1.0'
|
options.admin_url += '/v1.0'
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -40,6 +41,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
account = args[0]
|
account = args[0]
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -40,6 +41,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
account, user = args
|
account, user = args
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
|
@ -18,6 +18,7 @@ try:
|
|||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -60,6 +61,8 @@ If the [user] is '.groups', the active groups for the account will be listed.
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) > 2:
|
if len(args) > 2:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -40,6 +41,8 @@ if __name__ == '__main__':
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if args:
|
if args:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
|
@ -18,6 +18,7 @@ try:
|
|||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
from getpass import getpass
|
||||||
import gettext
|
import gettext
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
@ -50,6 +51,8 @@ Example: %prog -K swauthkey test storage local http://127.0.0.1:8080/v1/AUTH_018
|
|||||||
(options, args) = parser.parse_args(args)
|
(options, args) = parser.parse_args(args)
|
||||||
if len(args) != 4:
|
if len(args) != 4:
|
||||||
parser.parse_args(['-h'])
|
parser.parse_args(['-h'])
|
||||||
|
if not options.admin_key:
|
||||||
|
options.admin_key = getpass()
|
||||||
account, service, name, url = args
|
account, service, name, url = args
|
||||||
parsed = urlparse(options.admin_url)
|
parsed = urlparse(options.admin_url)
|
||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user