-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
290 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,7 @@ This extension collects telemetry data to help improve our products. Please read | |
``` | ||
telemetry.enableTelemetry = false | ||
``` | ||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
@@ -134,3 +135,7 @@ contact [[email protected]](mailto:[email protected]) with any additio | |
Please see below documents to learn how to contribute: | ||
- [How to build, run and debug from source](https://github.com/VSChina/vscode-ansible/wiki/How-to-Contribute) | ||
- [Coding Guidelines](https://github.com/VSChina/vscode-ansible/wiki/Coding-Guidelines) | ||
|
||
|
||
## Release Notes and Thank you | ||
Please see our [releases](https://github.com/VSChina/vscode-ansible/releases) to see detail in each release, and `Thank you`. Or check [CHANGELOG](./CHANGELOG.md). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use strict'; | ||
|
||
import * as storage from 'azure-storage'; | ||
import { FileService } from 'azure-storage'; | ||
import * as path from 'path'; | ||
|
||
const DIRECTORY_NAME = 'ansible-playbooks'; | ||
|
||
export function uploadFilesToAzureStorage(localFileName: string, storageAccountName: string, storageAccountKey: string, fileShareName: string): Promise<void> { | ||
const client = storage.createFileService(storageAccountName, storageAccountKey); | ||
|
||
return createFileShare(client, fileShareName) | ||
.then(() => { | ||
return createDirectory(client, fileShareName, DIRECTORY_NAME); | ||
}) | ||
.then(() => { | ||
return createFile(client, fileShareName, DIRECTORY_NAME, path.basename(localFileName), localFileName); | ||
}) | ||
.catch((err) => { throw err; }); | ||
} | ||
|
||
function createFileShare(client: FileService, fileShareName: string): Promise<void> { | ||
return new Promise<void>((resolve, reject) => { | ||
client.createShareIfNotExists(fileShareName, (err, result, response) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}) | ||
} | ||
|
||
function createDirectory(client: FileService, fileShareName: string, dirname: string): Promise<void> { | ||
return new Promise<void>((resolve, reject) => { | ||
client.createDirectoryIfNotExists(fileShareName, dirname, (err, result, response) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
function createFile(client: FileService, fileShare: string, dirName: string, src: string, dest: string): Promise<void> { | ||
return new Promise<void>((resolve, reject) => { | ||
client.createFileFromLocalFile(fileShare, dirName, src, dest, (err, result, response) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}) | ||
}) | ||
} | ||
|
||
export function getCloudShellPlaybookPath(fileShareName: string, playbook: string): string { | ||
return './clouddrive/' + DIRECTORY_NAME + '/' + path.basename(playbook); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.