Skip to content

Conversation

@maddieclayton
Copy link
Contributor

@maddieclayton maddieclayton commented Apr 20, 2018

Description

#5896

Checklist

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also add to the job cmdlet tests to verify these properties are copied.

{
get
{
if (_asJobSessionState == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can instantiate this lazily, because it might be first referenced inside a job - I think we need to instantiate it either during BeginProcessing. or in the cmdlet constructor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}

private RuntimeDefinedParameterDictionary _copiedDynamicParameters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we assignign a value to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assign it once the dynamic parameters are created in the cmdlet - there is no base property for DynamicParameters, and they can be changed after the AzurePSCmdlet is instantiated.

@maddieclayton
Copy link
Contributor Author

@azuresdkci Test this please

if (_copiedDynamicParameters == null)
{
_copiedDynamicParameters = new RuntimeDefinedParameterDictionary();
return _copiedDynamicParameters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this extra return is unnecessary

MyInvocation.MyCommand.Parameters.Keys.ToArray());
}
}
this.CopiedDynamicParameters = dynamicParameters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this isn't the interface I was hoping for. Is this the only place we can get DynamicParameters from?

If we need to do this, I think a void method with a bit less esoteric name, like ```void RegisterDynamicParameters(RuntimeParamaterDictionary paremeters) might be a more intuitive option for new usages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I could not find any way to get the dynamic parameters outside of copying them over during runtime. I created the void method and updated the relevant files.

this.dynamicParameters.Add(param.Name, dp);
}
}
this.CopiedDynamicParameters = dynamicParameters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra vertical space after '}'


private SessionState _asJobSessionState;

public SessionState AsJobSessionState
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't Hide SessionState, and throw if it is used, thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I'm wondering if my previous advice about not hiding was good. If we can get the propertes using base., then hiding them would make the interface simpler.

Otherwise, we should just rething the name of CopiedParameterDictionary (maybe AsJobParameterDictionary)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to hide it here - updated accordingly.

@markcowl markcowl removed their assignment Apr 23, 2018
@markcowl markcowl removed their assignment Apr 24, 2018
@markcowl
Copy link
Member

@cormacpayne cormacpayne merged commit 450e76e into Azure:preview Apr 24, 2018
@maddieclayton maddieclayton deleted the AsJobBug branch April 25, 2018 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants