本文整理汇总了Python中pyos.set_credential_file函数的典型用法代码示例。如果您正苦于以下问题:Python set_credential_file函数的具体用法?Python set_credential_file怎么用?Python set_credential_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_credential_file函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_credential_file
def test_set_credential_file(self):
with utils.SelfDeletingTempfile() as tmpname:
with open(tmpname, "wb") as tmp:
tmp.write("[keystone]\n")
tmp.write("username = %s\n" % self.username)
tmp.write("password = %s\n" % self.password)
tmp.write("tenant_id = %s\n" % self.tenant_id)
pyos.set_credential_file(tmpname)
self.assertEqual(pyos.identity.username, self.username)
self.assertEqual(pyos.identity.password, self.password)
self.assertTrue(pyos.identity.authenticated)
示例2: in
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
from __future__ import print_function
import os
import pyos
pyos.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyos.set_credential_file(creds_file)
cbs = pyos.cloud_blockstorage
# This assumes that you have are deleting the volumes named 'my_fast_volume'
# and 'my_standard_volume' that were created in create_volume.py.
for nm in ("my_fast_volume", "my_standard_volume"):
try:
vol = cbs.findall(name=nm)[0]
except IndexError:
print("There is no volume named '%s'. Skipping..." % nm)
vol = None
if vol:
print("Deleting", vol)
vol.delete()
print()
print("Done.")
示例3: setUp
def setUp(self):
pyos.set_credential_file(creds_file)