22
22
using System . IO ;
23
23
using System . Linq ;
24
24
using System . Management . Automation ;
25
+ using Newtonsoft . Json . Linq ;
25
26
26
27
namespace Microsoft . Azure . Commands . Compute . Extension . Chef
27
28
{
@@ -257,6 +258,7 @@ private Hashtable PublicConfiguration
257
258
bool IsBootstrapOptionsEmpty = string . IsNullOrEmpty ( this . BootstrapOptions ) ;
258
259
bool IsJsonAttributeEmpty = string . IsNullOrEmpty ( this . JsonAttribute ) ;
259
260
bool IsChefDaemonIntervalEmpty = string . IsNullOrEmpty ( this . ChefDaemonInterval ) ;
261
+ bool IsBootstrapVersionEmpty = string . IsNullOrEmpty ( this . BootstrapVersion ) ;
260
262
string BootstrapVersion = string . IsNullOrEmpty ( this . BootstrapVersion ) ? "" : this . BootstrapVersion ;
261
263
bool IsDaemonEmpty = string . IsNullOrEmpty ( this . Daemon ) ;
262
264
@@ -308,7 +310,10 @@ private Hashtable PublicConfiguration
308
310
}
309
311
310
312
var hashTable = new Hashtable ( ) ;
311
- hashTable . Add ( BootstrapVersionTemplate , BootstrapVersion ) ;
313
+ if ( ! IsBootstrapVersionEmpty )
314
+ {
315
+ hashTable . Add ( BootstrapVersionTemplate , BootstrapVersion ) ;
316
+ }
312
317
hashTable . Add ( ClientRbTemplate , ClientConfig ) ;
313
318
314
319
if ( ! IsRunListEmpty )
@@ -318,12 +323,14 @@ private Hashtable PublicConfiguration
318
323
319
324
if ( ! IsBootstrapOptionsEmpty )
320
325
{
321
- hashTable . Add ( BootStrapOptionsTemplate , this . BootstrapOptions ) ;
326
+ JObject bootstrap_option_json = JObject . Parse ( this . BootstrapOptions ) ;
327
+ hashTable . Add ( BootStrapOptionsTemplate , bootstrap_option_json ) ;
322
328
}
323
329
324
330
if ( ! IsJsonAttributeEmpty )
325
331
{
326
- hashTable . Add ( JsonAttributeTemplate , JsonAttribute ) ;
332
+ JObject json_attribute_json = JObject . Parse ( this . JsonAttribute ) ;
333
+ hashTable . Add ( JsonAttributeTemplate , json_attribute_json ) ;
327
334
}
328
335
329
336
if ( ! IsChefDaemonIntervalEmpty )
@@ -336,6 +343,7 @@ private Hashtable PublicConfiguration
336
343
hashTable . Add ( DaemonTemplate , this . Daemon ) ;
337
344
}
338
345
346
+
339
347
this . publicConfiguration = hashTable ;
340
348
}
341
349
0 commit comments