小编Aut*_*ner的帖子

kubectl wait --for=condition=complete --timeout=30s

我正在尝试通过本文档使用 kubectl wait 命令检查 pod 的状态。以下是我正在尝试的命令

kubectl wait --for=condition=complete --timeout=30s -n d1 job/test-job1-oo-9j9kj
Run Code Online (Sandbox Code Playgroud)

以下是我得到的错误

Kubectl error: status.conditions accessor error: Failure is of the type string, expected map[string]interface{}
Run Code Online (Sandbox Code Playgroud)

和我的kubectl -o json output can be accessed via this github 链接

有人可以帮我解决这个问题吗

kubernetes kubectl

22
推荐指数
3
解决办法
3万
查看次数

Python 请求模块中的 SSLError

我想使用从服务器生成的证书从客户端向服务器进行身份验证。我有一个 server-ca.crt,下面是正在运行的 CURL 命令。如何使用 python requests 模块发送类似的请求。

$ curl -X GET -u sat_username:sat_password \
-H "Accept:application/json" --cacert katello-server-ca.crt \
https://satellite6.example.com/katello/api/organizations
Run Code Online (Sandbox Code Playgroud)

我尝试过以下方法,但出现了一些异常,有人可以帮助解决这个问题吗?

 python requestsCert.py
Traceback (most recent call last):
  File "requestsCert.py", line 2, in <module>
    res=requests.get('https://satellite6.example.com/katello/api/organizations', cert='/certificateTests/katello-server-ca.crt', verify=True)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 68, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", …
Run Code Online (Sandbox Code Playgroud)

python ssl python-requests

4
推荐指数
1
解决办法
5189
查看次数

如何使用selenium2library和Robot Framework从windows目录上传文件

有人可以帮助我如何使用selenium2library和Robot Framework从Windows目录上传文件.我尝试在selenium2library中使用选择文件命令,但我收到错误,因为本地文件系统中不存在文件.我不确定目录路径是否是未考虑或任何其他问题.请给我有效的代码或任何替代解决方案.任何帮助将不胜感激.以下是我试过的命令

Choose file     xpath = //input[@firmware-upgrade='firmware']       /Downloads/Cambium_Builds/Falcon/ePMP1000-Hotspot-2.5.1-b3.tar
Run Code Online (Sandbox Code Playgroud)

HTML标签是`

图像位置和HTML标记`

robotframework selenium2library

3
推荐指数
1
解决办法
5439
查看次数

Python 如何使用 multiprocessing.pool 并行下载多个文件

我正在尝试使用multiprocessing.Pool.下载和提取 zip 文件。但是每次执行脚本时,只会下载3 个zip ,并且目录中看不到剩余的文件(CPU % 也达到 100%)。有人可以帮助我如何解决这个问题/建议更好的方法并遵循我尝试过的代码段。我对多处理完全陌生。我的目标是在不达到最大 CPU 的情况下并行下载多个文件。

import StringIO
import os
import sys
import zipfile
from multiprocessing import Pool, cpu_count

import requests

filePath = os.path.dirname(os.path.abspath(__file__))
print("filePath is %s " % filePath)
sys.path.append(filePath)
url = ["http://mlg.ucd.ie/files/datasets/multiview_data_20130124.zip",
       "http://mlg.ucd.ie/files/datasets/movielists_20130821.zip",
       "http://mlg.ucd.ie/files/datasets/bbcsport.zip",
       "http://mlg.ucd.ie/files/datasets/movielists_20130821.zip",
       "http://mlg.ucd.ie/files/datasets/3sources.zip"]


def download_zips(url):
    file_name = url.split("/")[-1]
    response = requests.get(url)
    sourceZip = zipfile.ZipFile(StringIO.StringIO(response.content))
    print("\n Downloaded {} ".format(file_name))
    sourceZip.extractall(filePath)
    print("extracted {} \n".format(file_name))
    sourceZip.close()


if __name__ == "__main__":
    print("There are {} CPUs on this machine ".format(cpu_count()))
    pool = …
Run Code Online (Sandbox Code Playgroud)

python python-multiprocessing

3
推荐指数
1
解决办法
7149
查看次数

如何使用机器人框架遍历JSON数组

我想遍历json响应并获取id和name元素数据。我正在尝试的响应json和代码如下。有人可以让我知道我在做什么错。

[
  {
    "id": 3,
    "policyRevId": 3,
    "busId": "POL_0003",
    "revision": 1,
    "name": "CIS Microsoft Windows Server 2012 R2 v2.2.1"
    },
  {
    "id": 2,
    "policyRevId": 2,
    "busId": "POL_0002",
    "revision": 1,
    "name": "CIS SUSE Linux Enterprise Server 11 Benchmark v 2.0"

  },
  {
    "id": 1,
    "policyRevId": 1,
    "busId": "POL_0001",
    "revision": 1,
    "name": "Payment Card Industry (PCI) Data Security Standard version 3.1"
  }
]


*** Settings ***
Library           RequestsLibrary
Library           Collections
Library           strings


*** Test case ***

Get Policy With Auth
    @{auth}=  Create …
Run Code Online (Sandbox Code Playgroud)

python-2.7 robotframework

2
推荐指数
1
解决办法
3488
查看次数

如何解析kubectl描述输出并获得所需的字段值

我正在尝试使用kubectl describe命令从特定的Pod中获取Nodeport。从这个问题中我知道-o选项不适用于描述,因此我正在尝试以下方式,但是我没有得到所需的值,有人可以纠正我。

kubectl -n core describe svc/pg-debug
Name:                     pg-debug
Namespace:                core
Labels:                   <none>
Annotations:              <none>
Selector:                 app=postgresql-default
Type:                     NodePort
IP:                       172.17.17.19
Port:                     <unset>  5432/TCP
TargetPort:               5432/TCP
NodePort:                 <unset>  24918/TCP
Endpoints:                172.16.90.10:5432
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
Run Code Online (Sandbox Code Playgroud)

以下是我试图获得价值的命令 "24918"

kubectl -n core describe svc/pg-debug | grep NodePort |awk -F:  '/nodePort/{gsub(/ /,"",$2)}'
Run Code Online (Sandbox Code Playgroud)

kubernetes kubectl

2
推荐指数
1
解决办法
538
查看次数

如何使用selenium2library检查文件是否从浏览器下载

有人可以帮助我如何使用selenium2library,RobotFramework检查文件是否已从浏览器下载.在我当前的测试中,我可以单击下载按钮并且文件正在下载但是如果文件没有下载则会发生什么情况.任何示例代码都很有帮助.

robotframework selenium-webdriver selenium2library

1
推荐指数
1
解决办法
9786
查看次数