小编Tre*_*van的帖子

使用 ansible-galaxy 直接从 git URI 安装 Ansible 集合

的文档ansible-galaxy说明如下:

ansible-galaxy 命令与 Ansible 捆绑在一起,您可以使用它从 Galaxy 或直接从基于 git 的 SCM 安装角色。您还可以使用它在 Galaxy 网站上创建新角色、删除角色或执行任务。

我试图弄清楚如何“直接从基于 git 的 SCM ”安装 Ansible 集合,如所示。当我ansible-galaxy collections --help从 MacOS Catalina 上的 Ansible 2.9.1运行时,我看到以下内容:

usage: ansible-galaxy collection install [-h] [-s API_SERVER]
                                         [--api-key API_KEY] [-c] [-v] [-f]
                                         [-i] [-n | --force-with-deps]
                                         [-p COLLECTIONS_PATH]
                                         [-r REQUIREMENTS]
                                         [collection_name [collection_name ...]]

positional arguments:
  collection_name       The collection(s) name or path/url to a tar.gz
                        collection artifact. This is mutually exclusive with
                        --requirements-file.

optional arguments:
  -h, --help            show this …
Run Code Online (Sandbox Code Playgroud)

ansible ansible-galaxy

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

IIS 7 - .NET可扩展性和ASP.NET之间的区别

嘿,在Windows功能控制面板小程序中,在Internet信息服务 - >万维网服务 - >应用程序开发功能下,有两个选项:".NET可扩展性"和"ASP.NET".

这两个选项有什么区别?如果我正在开发简单的ASP.NET Web应用程序/服务,是否需要.NET Extensibility选项?

我谷歌的条款,并提出了这个链接:

http://forums.iis.net/t/1146942.aspx

这个链接让我很困惑,因为响应(来自一个假定的Microsoft员工)说要测试.NET Extensibility,你创建一个简单的ASPX页面,并尝试加载它.这似乎(对我来说)更像是对ASP.NET选项的测试.

伙计们,有什么线索吗?

.net c# asp.net

7
推荐指数
2
解决办法
8123
查看次数

使用PowerShell设置私钥权限

我有一个PowerShell脚本,可以将pfx证书安装到LocalMachine证书库中.该函数如下所示:

function Add-Certificate {
param
(
    [Parameter(Position=1, Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [string]$pfxPath,

    [Parameter(Position=2, Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [string]$pfxPassword
)

    Write-Host "Installing certificate" -ForegroundColor Yellow

    try 
    {
        $pfxcert = new-object system.security.cryptography.x509certificates.x509certificate2
        $pfxcert.Import($pfxPath, $pfxPassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")

        $store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", LocalMachine
        $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite");
        $store.Add($pfxcert);
        $store.Close();

        return $pfxcert
    }
    catch 
    {
        throw
    }
}
Run Code Online (Sandbox Code Playgroud)

当我打开证书管理器以验证安装时,我可以看到它已正确安装.

我的过程的下一步是将证书的权限分配给服务帐户.

function Set-CertificatePermission
{
    param
    (
        [Parameter(Position=1, Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$pfxThumbPrint,

        [Parameter(Position=2, Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$serviceAccount
    )

    $cert = Get-ChildItem -Path cert:\LocalMachine\My | Where-Object -FilterScript { $PSItem.ThumbPrint -eq $pfxThumbPrint; };

    # Specify …
Run Code Online (Sandbox Code Playgroud)

permissions powershell pfx

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

插入USB驱动器时启动PowerShell脚本

驱动器插入PC后,是否可以启动USB驱动器上的PowerShell脚本?它必须将所有PDF文件从PC复制到USB驱动器,但这不是问题.我唯一不知道的是如何在插入USB驱动器后立即启动脚本.

有人可以帮忙吗?

windows powershell

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

删除PowerShell DSC配置

应用后,是否可以从计算机中删除DSC配置?

例如,我有一个configuration块如下:

configuration SevenZip {
    Script Install7Zip {
        GetScript = {
            $7ZipFolder = '{0}\7-Zip' -f $env:ProgramFiles;
            $Result = @{
                Result = '';
                }
            if (Test-Path -Path $7ZipFolder) {
                $Result.Result = 'Present';
            }
            else {
                $Result.Result = 'Nonpresent';
            }
            Write-Verbose -Message $Result.Result;
            $Result;
        }
        SetScript = {
            $7ZipUri = 'http://colocrossing.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920-x64.msi';
            $OutputFile = '{0}\7-Zip.msi' -f $env:TEMP;
            Invoke-WebRequest -Uri $7ZipUri -OutFile $OutputFile;
            Write-Verbose -Message ('Finished downloading 7-Zip MSI file to {0}.' -f $OutputFile);

            $ArgumentList = '/package "{0}" /passive /norestart /l*v "{1}\Install …
Run Code Online (Sandbox Code Playgroud)

powershell dsc

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

Visual Studio 2015 RC ::键盘快捷键"提交当前文件"

我在Windows 10 Build 10130上使用Visual Studio 2015 Release Candidate(RC).

我想在代码编辑器窗口中创建一个Visual Studio 2015键盘快捷方式"提交当前文件",或者在"解决方案资源管理器"窗口中选择了一个或多个文件.

这怎么可能?

visual-studio-2015

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

将另一个文件添加到现有的GitHub Gist

我有一个现有的GitHub Gist,我想添加另一个文件.

GitHub Gist API的数据模型表明可以将多个文件添加到Gist.

我怎么能做到这一点?

gist

7
推荐指数
3
解决办法
1640
查看次数

搜索.NET Core或标准NuGet包

我在Mac OS X上使用Visual Studio Code开发.NET Core Web API.我已经知道添加NuGet引用project.json文件中手动完成的.

但是,我不太确定如何搜索NuGet for .NET Core特定库..NET Core文档中Mac OS X教程仅指示开发人员添加项目依赖项,并且没有详细说明开发人员如何知道/发现依赖项名称.

有没有办法专门搜索NuGet的.NET Core库和/或与.NET Standard兼容的库?我想使用Mac OS X终端甚至VSCode来做到这一点.但是,任何解决方案都是一个很好的起点.

PS.我确实遇到了反向包搜索,但我不知道是谁创建它,它是如何最新的,以及它是否会在六个月后可用.

c# macos .net-core visual-studio-code

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

AWS SAM CLI 在构建、打包和部署期间忽略我的 Python 依赖项

我正在尝试使用 SAM CLI 工具从 MacOS 部署 AWS Lambda 函数,而不是使用 Docker 容器。

  • SAM CLI 版本 0.4.0
  • Lambda 函数的 Python 3.8 运行时
  • 在 MacOS 上本地安装 Python 3.7
  • 我有一个requirements.txt文件,与我的 Lambda 函数文件位于同一目录中

需求.txt

boto3
botostubs
Run Code Online (Sandbox Code Playgroud)

部署脚本 (PowerShell)

sam build --template-file $InputTemplate
sam package --region $AWSRegion --template-file $InputTemplate --profile $ProfileName --s3-bucket $BucketName --output-template-file $OutputTemplate
sam deploy --region $AWSRegion --profile $ProfileName --template-file $OutputTemplate --stack-name $StackName --capabilities CAPABILITY_NAMED_IAM
Run Code Online (Sandbox Code Playgroud)

实际行为

SAM CLI 忽略我的requirements.txt文件,只部署我的源代码。当我测试我的函数时,这会导致以下错误。

{
  "errorMessage": "Unable to import module 'xxxxxxxxxxxxxx': No module named 'botostubs'", …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-lambda

7
推荐指数
2
解决办法
4853
查看次数

next-auth 中 useSession() 的“加载”返回值是什么?

我正在编写一个 Next.js 项目,并使用 GitHub 和next-auth. 在 的示例中next-auth,有一个对 的调用useSession(),它返回两个对象:sessionloading。但是,我见过的所有示例都没有实际使用该loading对象。

import React from 'react'
import { 
  useSession, 
  signin, 
  signout 
} from 'next-auth/client'

export default () => {
  const [ session, loading ] = useSession()

  return <p>
    {!session && <>
      Not signed in <br/>
      <button onClick={signin}>Sign in</button>
    </>}
    {session && <>
      Signed in as {session.user.email} <br/>
      <button onClick={signout}>Sign out</button>
    </>}
  </p>
}
Run Code Online (Sandbox Code Playgroud)

问题: 的目的loading是什么,在实践中是如何使用的?

next.js next-auth

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