AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-791983

Sara June's questions

Martin Hope
Sara June
Asked: 2022-01-01 10:34:58 +0800 CST

如何使用jenkins修复python模块未找到错误?

  • 2

我用我的詹金斯工作运行了 pip freeze 命令,下面是输出

pip freeze 
fpdf==1.7.2
textfile==0.1.4

pip install textfile 
Requirement already satisfied: textfile in c:\python39\lib\site-packages (0.1.4)

但是当我将 python 脚本作为作业运行时,出现如下错误。

 $ python C:\Users\ADMINI~1\AppData\Local\Temp\jenkins2938633000292670144.py
Traceback (most recent call last):
  File "C:\Users\ADMINI~1\AppData\Local\Temp\jenkins2938633000292670144.py", line 1, in <module>
    import textile
ModuleNotFoundError: No module named 'textile'
Build step 'Execute Python script' marked build as failure
No emails were triggered.
Finished: FAILURE
python jenkins
  • 2 个回答
  • 1794 Views
Martin Hope
Sara June
Asked: 2021-12-28 01:35:03 +0800 CST

如何使用 azure devops 管道向团队发送通知?

  • 0

我看到有一个用于 azure 管道的团队应用程序,并补充说它要求对我们添加的组进行完整的管道访问。

而不是使用它,我只想向构建成功或失败的团队组或个人用户发送通知。

任何人都可以指导如何做到这一点。

可能最后的任何管道步骤也是可行的。

azure github azure-devops-server azure-devops microsoft-teams
  • 1 个回答
  • 1000 Views
Martin Hope
Sara June
Asked: 2021-12-22 08:25:55 +0800 CST

如何解决,ubuntu 没有在 hyper-v 上获取 IP 地址?

  • 1

我使用 hyper-v 作为管理程序并在其上安装了 ubuntu 21。

操作系统版本

在那里,每当我启动 VM 时,eth0(仅连接一个网络接口,Hyper-v 的默认交换机)没有获得 IP 并显示为关闭。

ip下来

请使用我的快照,因为我无法通过 ssh 连接到机器来复制输出并将其作为文本粘贴到此处。

我的机器上没有 /etc/network/interfaces 文件,因为许多论坛问题都在修改此文件上的内容。

为了建立这个网络适配器,我运行了下面的命令。

sudo ip link set eth0 up

然后,网络适配器现在启动但没有 ip4 地址。

向上但只有 ipv6

为了获取 ip 地址,我运行了下面的命令,它得到了 ip。

sudo dhclient eth0

然后,我得到 IPv4 地址。

收到 IPv4 地址

我每次在机器上都需要这样做。

如何解决这个问题?

ubuntu networking hyper-v ipv4 linux-networking
  • 1 个回答
  • 2345 Views
Martin Hope
Sara June
Asked: 2021-12-05 03:48:28 +0800 CST

子网没有在 azure 上使用 terraform 创建,如何解决?

  • 0

我正在尝试在 azure 上创建两台带有 terraform 的 centos 8 机器。

我的模板 github链接

当我尝试申请时,我遇到了与政策相关的错误。你能建议如何解决这个问题吗?

>     │ Error: creating Subnet: (Name "subnetforAutomation" / Virtual Network Name "vnetforAutomation" / Resource Group "automation_mart"):
> network.SubnetsClient#CreateOrUpdate: Failure sending request:
> StatusCode=0 -- Original Error: Code="RequestDisallowedByPolicy"
> Message="Resource 'subnetforAutomation' was disallowed by policy.
> Policy identifiers:
> '[{\"policyAssignment\":{\"name\":\"Deny-Subnet-Without-Nsg\",\"id\":\"/providers/Microsoft.Management/managementGroups/QSFT-landingzones/providers/Microsoft.Authorization/policyAssignments/Deny-Subnet-Without-Nsg\"},\"policyDefinition\":{\"name\":\"Subnets
> should have a Network Security Group
> \",\"id\":\"/providers/Microsoft.Management/managementGroups/QSFT/providers/Microsoft.Authorization/policyDefinitions/Deny-Subnet-Without-Nsg\"}}]'."
> Target="subnetforAutomation"
> AdditionalInfo=[{"info":{"evaluationDetails":{"evaluatedExpressions":[{"expression":"type","expressionKind":"Field","expressionValue":"Microsoft.Network/virtualNetworks/subnets","operator":"Equals","path":"type","result":"True","targetValue":"Microsoft.Network/virtualNetworks/subnets"},{"expression":"Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id","expressionKind":"Field","operator":"Exists","path":"properties.networkSecurityGroup.id","result":"True","targetValue":"false"}]},"policyAssignmentDisplayName":"Deny-Subnet-Without-Nsg","policyAssignmentId":"/providers/Microsoft.Management/managementGroups/QSFT-landingzones/providers/Microsoft.Authorization/policyAssignments/Deny-Subnet-Without-Nsg","policyAssignmentName":"Deny-Subnet-Without-Nsg","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/QSFT-landingzones","policyDefinitionDisplayName":"Subnets
> should have a Network Security Group
> ","policyDefinitionEffect":"Deny","policyDefinitionId":"/providers/Microsoft.Management/managementGroups/QSFT/providers/Microsoft.Authorization/policyDefinitions/Deny-Subnet-Without-Nsg","policyDefinitionName":"Deny-Subnet-Without-Nsg"},"type":"PolicyViolation"}]
> 
>     │
>     │   with azurerm_subnet.subnet,
>     │   on main.tf line 24, in resource "azurerm_subnet" "subnet":
>     │   24: resource "azurerm_subnet" "subnet" {
>     │

我尝试保持内联,即 vnet 内的子网。在计划阶段本身从 VM 实例资源块中引用子网时,问题就出现了。

 Error: Unsupported attribute
│
│   on network.tf line 26, in resource "azurerm_network_interface" "example":
│   26:     subnet_id                     =  azurerm_virtual_network.vnet.subnet.id #azurerm_subnet.subnet.id
│
│ Can't access attributes on a set of objects. Did you mean to access an attribute across all elements of the set?
╵

//main.tf

## <https://www.terraform.io/docs/providers/azurerm/r/windows_virtual_machine.html>
resource "azurerm_windows_virtual_machine" "example" {
  name                = var.machine_details.name
  computer_name       = var.machine_details.name
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location
  size                = var.machine_details.size
  admin_username      = var.machine_details.username
  admin_password      = var.machine_details.password
  network_interface_ids = [
    azurerm_network_interface.example.id,
  ]

  os_disk {
    caching              = "ReadWrite"
    storage_account_type = "Standard_LRS"
  }

  source_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServer"
    sku       = "2019-Datacenter"
    version   = "latest"
  }
}

//网络.tf

## <https://www.terraform.io/docs/providers/azurerm/r/virtual_network.html>
resource "azurerm_virtual_network" "vnet" {
  name                = "vNet"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name

subnet{
 name = "internal"
 address_prefix     = "10.0.2.0/24"
 security_group = azurerm_network_security_group.example.id
}

}


## <https://www.terraform.io/docs/providers/azurerm/r/network_interface.html>
resource "azurerm_network_interface" "example" {
  name                = "example-nic"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name

  ip_configuration {
    name                          = "internal"
    subnet_id                     =  azurerm_virtual_network.vnet.subnet.id #azurerm_subnet.subnet.id
    private_ip_address_allocation = "Dynamic"
    public_ip_address_id          = azurerm_public_ip.myvm1publicip.id
  }
}

resource "azurerm_public_ip" "myvm1publicip" {
  name                = var.public_ip.name
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  allocation_method   = var.public_ip.allocation_method
  sku                 = var.public_ip.sku
}

resource "azurerm_network_security_group" "example" {
  name                = var.nsg
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  security_rule {
    name                       = "test123"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
}

//提供者.tf

## <https://www.terraform.io/docs/providers/azurerm/index.html>
provider "azurerm" {
  features {}
}

//rg.tf

## <https://www.terraform.io/docs/providers/azurerm/r/resource_group.html>
resource "azurerm_resource_group" "rg" {
  name     = "TerraformTesting2"
  location = var.location
}

//变量.tf

variable "location" {
  type        = string
  description = "Azure Region where all these resources will be provisioned"
  default     = "eastus2"
}

variable "public_ip" {
 

  default = {
      name              = "pip1"
      allocation_method = "Dynamic"
      sku               = "Basic"
    }
  
  
}

variable "nsg" {
  type        = string
  description = "Azure NSG"
  default     = "example-nsg"
}

variable "machine_details" {
  
  default = {
      name             = "example-vm2"
      size = "Standard_E2s_v3" #"Standard_F2"
      username               = "adminnasme"
      password = "MyPaword!@3"
    }
  
}
subnet terraform azure
  • 2 个回答
  • 676 Views
Martin Hope
Sara June
Asked: 2021-10-08 04:47:29 +0800 CST

如何使用 kustomize 从属性文件加载配置映射?

  • 2

我尝试使用 kustomize 将属性文件加载为配置映射。

为此,我在 github链接中创建了一个示例集。

使用基本文件:

#kustomize build base
apiVersion: v1
data:
  config: |-
    dbport=1234
    dcname=sfsdf
    dbssl=false
    locktime=300
    domainuser=
kind: ConfigMap
metadata:
  labels:
    owner: sara
  name: database-configmap
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
    owner: sara
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      owner: sara
  template:
    metadata:
      labels:
        app: nginx
        owner: sara
    spec:
      containers:
      - image: nginx
        name: nginx

使用外部文件:

#kustomize build file
apiVersion: v1
data:
  config: "dbport=156767\r\ndcname=dfsd\r\ndbssl=false\r\nlocktime=300\r\ndomainuser=somedts"
kind: ConfigMap
metadata:
  labels:
    env: dev
    owner: sara
  name: dev-database-configmap
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
    env: dev
    owner: sara
  name: dev-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      env: dev
      owner: sara
  template:
    metadata:
      labels:
        app: nginx
        env: dev
        owner: sara
    spec:
      containers:
      - image: nginx
        name: nginx

如果您观察到 configmap|被删除并替换\r\n为单个字符串。如何修复这种对齐方式?

kubernetes kubectl
  • 1 个回答
  • 610 Views
Martin Hope
Sara June
Asked: 2021-10-08 02:51:55 +0800 CST

如何在 Kustomize YAML 文件中加载 ConfigMap?

  • 1

我原来的 YAML

基础/部署.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - image: nginx
          name: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: database-configmap
data:
  config: |
    dbport=1234
    dcname=sfsdf
    dbssl=false
    locktime=300
    domainuser=

基础/Kustomization.yaml

resources:
  - deployment.yaml

commonLabels:
  owner: sara

从 base 的父文件夹:

kustomize build base

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
    owner: sara
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      owner: sara
  template:
    metadata:
      labels:
        app: nginx
        owner: sara
    spec:
      containers:
      - image: nginx
        name: nginx

如果您在上面观察到,ConfigMap 正在被丢弃,请建议如何解决该问题。

kubernetes
  • 1 个回答
  • 502 Views
Martin Hope
Sara June
Asked: 2021-08-11 05:36:14 +0800 CST

如何将多个标签应用于詹金斯节点?

  • 1

当我将标签应用于节点时,它按预期工作并且能够选择该节点的工作。

但是,如果我应用多个标签,它就不起作用。正如我所观察到的,它将它们都视为单个标签。

示例:标签:devbuild

它正在与工作一起工作。

但,

标签:devbuild,installernode

它不适用于任何带有“devbuild”或“installernode”标签的作业,即使我尝试过;但同样的问题。

请建议如何将多个标签应用于单个节点。

jenkins
  • 1 个回答
  • 2876 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve