As a tool for developing and supporting applications, Designer can be used both interactively (to edit configurations or describe 1C:Enterprise script algorithms) and from the command line (to update, dump and restore configurations, etc.). For instance, the new development environment (
Our initial intent was to speed up EDT-Designer interactions. However, we decided to extend the task at hand. Ultimately, we developed a universal way of working with Designer through the command line. We called it the agent mode. In agent mode, Designer can run an arbitrary number of external commands without shutting down.
Benefits
The main advantage for the EDT is the reduced time it now takes to run operation sequences, such as dumping configurations to files, restoring configurations from files, and updating database configurations. After all, inAnother benefit we didn't plan for originally is that you can now operate Designer via standard SSH clients, meaning you can automate your Designer operations. This is something we would like to go into more detail about.
How it works
To start Designer in the new mode, the command-line option /AgentMode is used, along with a number of other secondary options that define connection settings. At startup, the infobase Designer is supposed to work with is specified.
Once the agent is up and running, you can work with the infobase, alternating between the agent (by executing SSH commands) and Designer running in regular mode. What does ‘alternating’ mean?
To manage Designer via the SSH client, first, you need to connect to the infobase. This simple operation looks like this:
designer>common connect-ib The operation is completed |
If you run the SSH disconnect command, you can (without shutting the agent down) start another Designer in regular mode and work with the infobase as usual, e.g. edit modules. After shutting down the regular-mode Designer you can execute SHH commands to connect to the infobase again via the running agent. This is what the short version of the sequence looks like:
- Start Designer in agent mode (SSH session starts)
- Connect to infobase (SSH command)
- ... Other SSH commands
- ... Other SSH commands
- Disconnect from infobase (SSH command)
- Start Designer in regular mode
- ... Modify the infobase the Designer agent is connected to
- ... Modify the infobase the Designer agent is connected to
- Shut down Designer operating in regular mode
- Connect to infobase (SSH command)
- ... Other SSH commands
- ... Other SSH commands
- Disconnect from infobase (SSH command)
- Shut down Designer operating in agent mode (SSH command, SSH session termination)
SSH commands
You can connect to Designer running in agent mode via standard SSH clients, such as- Connect to / disconnect from infobases
- Dump configurations to / restore from files (including partial dumping and restoring)
- Save/load external reports or data processors
- Update database configurations
- A number of utility commands
Example
As mentioned in the beginning, the SSH protocol will help you not only leverage the command line in standard SSH clients, but also automate your Designer operations by using programming languages other than 1C:Enterprise script. For instance, you need just a few lines in Python (based on the
import paramiko host = '192.168.1.1' user = 'login' secret = 'password' port = 1543 client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=host, username=user, password=secret, port=port) stdin, stdout, stderr = client.exec_command('common connect-ib') data = stdout.read() + stderr.read() ... stdin, stdout, stderr = client.exec_command('common disconnect-ib') data = stdout.read() + stderr.read() client.close() |
Specific features
Designer in itself defines a number of SSH-interaction restrictions.First of all, Designer operates in such a way that makes all SSH commands run synchronously. Only one SSH shell client and several SFTP clients can be connected to the infobase at the same time.
Second of all, there is a strict "one agent – one infobase" restriction. Given that authentication requires an infobase user name and password, the agent needs to know right away (i.e. at startup), which base it will be working with.
And third, one of the things we were aiming at when developing this mechanism was to be able to monitor Designer’s command execution progress. However, thorough analysis showed that not all Designer operations have such an option and that implementing it is quite a time-consuming task. For now, this option stays on our wish list.