Пример #1
0
 def run_main():
     # Suppress deprecation warnings that can occur when Python
     # compiles awscli. This is the normal behavior of the aws
     # utility and prevents the logout unit tests from failing.
     # https://github.com/techservicesillinois/awscli-login/pull/75
     import warnings
     warnings.filterwarnings("ignore", category=DeprecationWarning)
     main()
Пример #2
0
def decorate():
    old_stderr = sys.stderr
    redirected_error = sys.stderr = StringIO()
    try:
        driver = clidriver.create_clidriver()
        return_code = driver.main()
    finally:
        sys.stderr = old_stderr

    error_text = redirected_error.getvalue()

    if _was_token_expired(return_code, error_text):
        _re_authenticate(driver)
        clidriver.main()
    elif error_text is not None:
        old_stderr.write(error_text)
Пример #3
0
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

# Don't remove this line.  The idna encoding
# is used by getaddrinfo when dealing with unicode hostnames,
# and in some cases, there appears to be a race condition
# where threads will get a LookupError on getaddrinfo() saying
# that the encoding doesn't exist.  Using the idna encoding before
# running any CLI code (and any threads it may create) ensures that
# the encodings.idna is imported and registered in the codecs registry,
# which will stop the LookupErrors from happening.
# See: https://bugs.python.org/issue29288
u''.encode('idna')


import sys

from awscli.clidriver import main


if __name__ == "__main__":
    sys.exit(main())
Пример #4
0
 def run_main():
     main()