azure-contrib / azure-scripty Goto Github PK
View Code? Open in Web Editor NEWLibrary for scripting out the azure-cli
License: Other
Library for scripting out the azure-cli
License: Other
I want to be able to do something like this:
var serviceName = 'mymobileservice';
var sqlAdminUser = 'sqladmin';
var sqlAdminPassword = 'myP@ssw0rd!'
var createArgs = {
sqlServer: 'VMF1ASD',
sqlDb: 'mydb'
};
scripty.invoke('mobile create', [serviceName, sqlAdminUser, sqlAdminPassword], createArgs, function(err, results) {
// etc
});
Or this:
var createCommand = {
command: 'mobile create',
positional: ['mymobileservice', 'sqladmin', 'myP@ssw0rd!'],
sqlServer: 'VMF1ASD',
sqlDb: 'mydb'
}
scripty.invoke(createCommand, function(err, results) {
// etc
});
D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^
Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^
Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
D:\SourceCode\MOGA\Scripts\Trunk\Provisioning>node VMSetup.js
module.js:341
throw err;
^
Error: Cannot find module '../node_modules/azure-cli/lib/cli'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (D:\SourceCode\MOGA\Scripts\Trunk\Provisioning\node_modules\azure-scripty\lib\azure-scripty.js:6:11)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
Hi Glenn,
Right now if a user forgets to add a space between commands.
scripty.invoke('mobile table createservicename', function (err, results) {
console.log(err);
console.log(results);
}
gives err=undefined and results=null.
I tried some other random gibberish commands and it seems like invoke doesn't callback error that Azure CLI runs into.
Thanks!
-Mimi :)
For some reason, a valid script is not downloaded when using azure-scripty. The invocation calls back without errot but no file is downloaded. Using the azure cli directly with an identical command works OK.
var cli = require('azure-scripty');
var servicename = 'mymobileservice';
cli.invoke({
command: 'mobile table list',
positional: [servicename]
}, function(err, results) {
console.log(results);
// results is an array in an array
});
Results come back in an additional array
Just let me do this:
var cmds=[
{cmd:'azure mobile show clidemo', callback:onShow},
{cmd:'azure mobile create clidemo2'}
];
function onShow(err, result, callback, nextCommand) {
// do stuff with result
nextCommand.positional: [result.sqlServer]
callback(nextCommand);
}
scripty.invoke(cmds, function() { console.log('done'); } );
I'm trying to run the following code to create a VM, similar to how I use the "azure vm create" CLI (for a Windows Server 2012 image).
cmd = {
command: 'vm create',
positional: [vmName, imageName, 'administrator', password],
location: location,
rdp: true
};
scripty.invoke(cmd)
The scripts runs for a second or two and then prints:
Error: Command failed: The hosted service is not valid.
If I run the azure cli "vm create" command with the same values (positional and parameters) it works without a problem (the CLI creates a cloud service for the VM).
Any ideas what is wrong with this code?
I'm writing an azure script to retrieve all the blobs in a container, but I'm getting an error - "stdout maxBuffer exceeded."
It's the equivalent to this command line:
azure storage blob list <container> --account-name <foo> --account-key <bar>
By default azure-scripty logs every response to the console, making it hard to find your own logs. Change the default and add an optional verbose logging configuration option?
this would allow piping collection results into the next command that executes. The following cmd would have place holders indicating which values to pipe in.
For example this:
``` javascript````
var scripty = require('azure-scripty');
scripty.invoke(['azure site list','azure site config add foo=bar :name'],
function(err,results) {});
Would grab the list of websites, then loop through each site and add a config setting foo=bar. The :name syntax matches against the 'Name' property for each site.
For commands that return a large result like listing out blobs, scripty should support being able to stream the output rather than have to buffer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.